-
Notifications
You must be signed in to change notification settings - Fork 57
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
Add features to avoid accidentally editing text you can't see with an off-screen cursor #164
Comments
This is a good point. As you mention there are several ways we could make it more obvious that more than one selections are active. I'm not against adding a setting for styling selections based on whether there are multiple selections (e.g. having a different background color for the active line). With that said, there are two problems with changing the color of the status bar in VS Code:
|
Ah, the status bar colour thing is a shame, that would've been a nice solution. Another option would be a pop-up message warning me about editing off-screen text, or maybe just an option to disallow cursors from going off-screen entirely (maybe by just removing cursors that go off-screen). I'm not really sure. In Vim I don't think I ever accidentally edited text off screen, but in Kakoune/Dance you have cursors going all over the shop, which opens up a whole new world of mistakes you can make. Since editing text in programming is such a subconscious, flow-state thing it's really easy to just assume everything is working as expected. Sometimes multi-cursor editing can violate the principle of least astonishment, so I think effective communication through UI is quite important to mitigate that. Thanks for the consideration, in any case. Dance is fantastic and I'm really happy I can get back to my Kakoune muscle memory in VS Code. |
Related issue on Kakoune side: mawww/kakoune#2727 |
There are many good ideas in this thread, thanks for linking. Do note that if it ends up being added, it will only work for selections that are above or below the viewport, not the ones that are on the left or right of the viewport, since VS Code does not expose an API to know what columns are in the viewport. |
I have a prototype that displays at the top and bottom of the screen if some selections are hidden; I'm not sure what colors I should pick, though. I went with Edit: Here it is with |
I know I am a bit late to the party, but in my color-scheme the colored bar is a little bit too much for me, is there a way to only have the text? |
@BeastyBlacksmith Right now, no, but settings could be added for this. |
86afe9b adds a setting for this. "dance.modes": {
"...": {
"hiddenSelectionsIndicatorsDecoration": {
"...": "...",
},
},
}, To specify a default that applies to all modes, use the empty |
FWIW for future reference, I think a big way I was accidentally getting multiple selections was by trying to use shift+N (vim key) to go to the previous search option, rather than alt+N (dance key). Shift+N extends your selection to include the next search option, which also jumps your screen to it, so it's easy to miss that your selection just expanded when you do this. |
I use multiple cursors in Dance quite a lot for little things like aligning stuff, adjusting indentation, bulk-renaming etc. I'm finding sometimes -- I'm not sure why -- that I end up with multiple cursors, all but one of which are off-screen. So I think I'm typing in one place, but in actual fact I'm doing horrible damage and writing very confusing things elsewhere in the file I'm editing.
I'd really like to have an option to bother me with a pop-up message when I'm about to edit lines that are off screen. You'll always hit this when using the % command or something but I don't do that too much -- probably about 90% of the time that I edit something with an off-screen cursor, it's an accident and I have no idea it's happening.
At the moment the only indication you have that you're editing something where you can't see is this teensy tiny text down the bottom-right that says how many selections you have:
I think making multiple cursors more obvious or just an option to avoid editing lines you can't see would be a handy addition.
In Vim people often set their modeline to a different colour in insert vs normal vs visual mode, maybe Dance could use colours for normal vs insert vs insert-with-many-cursors so you know when you're doing some funky stuff.
(NB: I tried setting dance.insertMode.lineHighlight but it only highlights one line, even when you have multiple cursors. I'm not sure if that's a bug or not, but it's definitely not helpful in this case.)
Thank you!
The text was updated successfully, but these errors were encountered: