atom-archive / xray

An experimental next-generation Electron-based text editor
MIT License
8.48k stars 235 forks source link

Add multi cursor click selections #108

Open pranaygp opened 6 years ago

pranaygp commented 6 years ago

This builds on top of #107

You can hold alt and click on multiple points to multiple cursors. Also, when using a selection modifier on top of adding a new cursor (like click+drag or double/triple click), I fixed it so the modifier only applied on the latest/current selection (earlier it would affect all selections which had some funny effects 😛)

However, to enable selection modifiers only affecting the last cursor, I'm simply pushing a new cursor to selections (instead of binary searching to insert it in the right order). This lets me simply refer to last_mut(). I don't understand what the point of sorting it correctly is (would love an explanation, cc @nathansobo) but if we need to retain that, I can update this PR to have a variable tracking the newest "cursor".

gif

jstoiko commented 6 years ago

Apologies for the mistakenly submitted (and unsolicited) review. I have no way to undo it 👎.