-
Notifications
You must be signed in to change notification settings - Fork 722
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
Cancel object indent selection on lines with no indentation #1904
Comments
I find this problem a bit related to the umbrella topic of "undoing selections": #898 . In this kind of "oops" moment that is |
I agree with Delapouite on this one. I think I suspect that the bug you are experiencing is a different one though:
When the cursor is on what could be called 'third line', selecting indentation selects the whole buffer, when it should select first to fourth line (leaving func() alone). This is a bug in the indent selector. Is that the actual bug you are hitting ? |
Actually, no, not related to any bug – just a general thought about this text object's behaviour, and a thought more pragmatic than philosophical. Object indent is a good friend of mine, but I don't find the zero indent useful for selecting the entire buffer. A more likely scenario would be the problem of regaining my previous position and focus after seeing the cursor suddenly jump to the end of the buffer. I thought I might not be the only person who found this behaviour unhelpful (and possibly confusing to new users), so I raised the topic as a suggestion for an alternative default. You both mention this is related to the wider issue of losing selections. In this particular case the selection is conceptually simple, so anyone who wants to solve this "problem" can do so in straightforward way ahead of time:
An error occurs where a line does not begin with whitespace; the selection does not change. Anyway, I'll now close this issue. Thanks both for your input. |
Look for the first non empty line preceeding the current line, or if not found, the first non empty line following it. Fixes #1904
When on a line with no indentation, currently the entire buffer is selected with the commands
<a-a>i
and<a-i>i
.It's fairly easy to accidentally select the entire buffer, and I don't recall ever having the intention to use
<a-a>i
or<a-i>i
in this way.%
or%_
seem more obvious.I wonder if an improved default behaviour would be to show the "no selections remaining" message in the event of the indentation level being zero.
There's maybe also a logical intuition that at the left-most area of the buffer there is no indentation to select, and the command can therefore be considered invalid.
The text was updated successfully, but these errors were encountered: