Add multi-cursor support [WIP] #83
Closed
+345
−217
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey everyone, here is a functional but fairly limited PR to support multiple cursors in micro.
Short demo:
What's changed:
When
Ctrl-N
is typed outside of an active search (ie, a search started by using theCtrl-F
shortcut), the word under the cursor is selected. On every subsequent press ofCtrl-N
, a new cursor will be added for every match, and each match will be highlighted. To leave multi-cursor mode, the user can just type escape, or can click anywhere inside the terminal.What still needs work:
Multi-cursor mode active with x cursors
, or by figuring out how to show each individual cursor. Tcell seems to only have support for one cursor, but it might be possible to fake it visually.Since there are still kinks to work out, I added an option for
multicursor
defaulted tofalse
, so users won't run into unexpected trouble. I just wanted to make this PR since it's very difficult to keep this branch in a state where there aren't merge conflicts (like there are now), since the changes to makeCursor
become[]Cursor
are so widespread and seem to be the main source of conflicts.Anyway, sorry for writing a novel - let me know what you think of this. I'll fix the conflicts if you're interested in having this merged at this point in time. Also, this will close #5 when merged.