zed
zed copied to clipboard
vim: Convert from visual mode to normal mode with a single click
Release Notes:
- Fixed #4319
Here is a demo after the fix: https://github.com/zed-industries/zed/assets/22256154/a690f146-73c9-4b0e-8527-e4faf690cca2
Actually I'm not really sure should I submit my idea to discussion, since it's not a large change, and it's something like a bug fix. So I directly create a pr here.
We require contributors to sign our Contributor License Agreement, and we don't have @WindSoilder on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.
@cla-bot check
The cla-bot has been summoned, and re-checked this pull request!
Hey! Thanks for this! With this change, does opt+click still work, to create multiple cursors?
Thank you for a good question, I haven't thought about it.
After some testing, if I'm in visual mode, opt+click will go back to normal mode and create multiple cursors.
If I'm in normal mode, opt+click will create multiple cursors as normal.
@WindSoilder Thanks for the fix here!
I think we need to do this more carefully, as the current version breaks the visual block mode tests and opt-click in visual mode. If you want to pair with me on fixing this: https://calendly.com/conradirwin/pairing.
I think we should try only entering normal mode if there is exactly one selection and it is empty.
Some behaviors I'd like to work:
- visual block mode onto an empty line (this is the test that's failing)
- opt-click-and-drag to add another visual selection to an existing visual selection (currently this gets interrupted, I think because the local_selections_change fires on the click with an empty selection and stops my drag).
- opt-click on another line in visual line mode to create a new visual line selection.
@WindSoilder and I have a pairing session on Friday to get this over the line! Looking forward to it :D
@ConradIrwin I tried the latest preview where this was merged and when some text is selected, clicking elsewhere doesn't activate normal mode like Vim would.
@diocletiann strange, it seems to work for me... Are you clicking on the editor, or another part of the UI?
@diocletiann strange, it seems to work for me... Are you clicking on the editor, or another part of the UI?
Never mind, it's working now. Maybe I tried it before updating Zed Preview.