-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mouse selection support #509
Conversation
Signed-off-by: Dmitry Sharshakov <[email protected]>
Signed-off-by: Dmitry Sharshakov <[email protected]>
I think you can skip the double-clicking, it doesn't seem to be present on kakoune at least, not sure about vim. |
Signed-off-by: Dmitry Sharshakov <[email protected]>
Signed-off-by: Dmitry Sharshakov <[email protected]>
Really looking forward to this! I agree that double-click is probably not needed. If I want to select a bunch of words with the mouse, I'll probably just add cursors at each word with modifier-click, and then use a keyboard command to expand to word boundaries. That way it's "click, click, click, hotkey" rather than "click-click, click-click, click-click". Similarly for selecting a range of lines: I'd probably just drag the selection to encompass the lines I want, and then hit |
Signed-off-by: Dmitry Sharshakov <[email protected]>
You're right. If anyone wished that feature, right click can be used, but IMO that can be fully dropped really. |
Signed-off-by: Dmitry Sharshakov <[email protected]>
Signed-off-by: Dmitry Sharshakov <[email protected]>
Signed-off-by: Dmitry Sharshakov <[email protected]>
I've split out |
You can do this by setting |
Signed-off-by: Dmitry Sharshakov <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For an initial implementation I think we can merge this step by step rather than all at once. Just left click is good enough as the first step. I think we can have them as separate PR?
Currently there's some work on view switching also, but that can be sent in another PR if it succeeds. |
View switching is done locally. Should I push it here or do that later? |
Yeah include it, I'd like to wait for at least @cessen's review too |
Signed-off-by: Dmitry Sharshakov <[email protected]>
Now two TODOs are left for another PR:
|
This shouldn't be too hard. If shift is pressed, instead of making a new selection clone the old one then use selection.push to add a new range. It will automatically become the new primary one, so the dragging code needs no changes. I'd also like to see this behavior be configurable, if mouse = false in the config then the events should just not get enabled (I personally don't use the mouse and will disable it to reduce the amount of incoming crossterm events) The menu one isn't necessary and I think it's better to skip for term. |
Signed-off-by: Dmitry Sharshakov <[email protected]>
Maybe it would be nice to have a runtime command to change mouse behavior? |
Is it intended for drag-selection to create multiple cursors, or is that a bug? |
Not by default but probably possible with some combinations like ctrl. Like ctrl + drag a few stuff. |
Alt+Click makes a new cursor. Drag is a bit broken atm, see #509 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking better now, a couple more changes
Signed-off-by: Dmitry Sharshakov <[email protected]>
Signed-off-by: Dmitry Sharshakov <[email protected]>
Signed-off-by: Dmitry Sharshakov <[email protected]>
Signed-off-by: Dmitry Sharshakov <[email protected]>
Signed-off-by: Dmitry Sharshakov <[email protected]>
Signed-off-by: Dmitry Sharshakov <[email protected]>
Signed-off-by: Dmitry Sharshakov <[email protected]>
Signed-off-by: Dmitry Sharshakov <[email protected]>
Signed-off-by: Dmitry Sharshakov <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! I also tested locally, and everything seems to work great.
(I think we could use some more thorough tests, including e.g. CJK characters, graphemes, etc. but I can make a PR for that later myself. The basics are there.)
Note: the lint failures in the recent CI run are due to #525, not this PR.
@sh7dm |
Huge thanks to all the reviewers for the great help! |
Great work, @sh7dm! Thanks for taking the time and effort for this! |
TODO:
Double-clicking to select words (will probably need to add extra vars to state for counting)Select lines by dragging on the left sidePick items from menus using mouse (may be out of scope)