This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Select sibling syntax node should not select parent node's sibling #3079
Labels
You can continue the conversation there. Go to discussion →
Summary
Trying to select a non-existing sibling syntax node, the selection escapes the current scope to select a sibling of the parent node. This can be a source of frustration as (especially for visually complex languages where it's not always immediately visually obvious how many movements are required to get to where you're going) navigating between siblings sometimes involve repeated, imprecise movements; if you accidentally move too far and leave the scope, you have to move back to the parent node and re-enter it, starting from the first child node again. If the scope contains many nodes it can involve a significant number of movements to find your way back.
I would expect Alt-p/Alt-n (move to prev/next sibling syntax node) to stop at the beginning/end of current scope depth, or alternatively loop back to the first/last sibling, to be consistent with other movements when reaching first/last match in the document. This way, if you move too far you only have to perform one corrective movement in the opposite direction.
If I do intend to select a sibling node of the parent, I would do so explicitly with Alt-o (expand selection to parent syntax node) followed by Alt-p/Alt-n.
Reproduction Steps
I tried this:
Haskell example:
I intend to select the last function,
putStr
, but accidentally hit Alt-n one too many times.I expected this to happen:
Either nothing or selection would move to
zip vsSq cs & ... & unlines
so that I can hit Alt-p once to correct my movement.Instead, this happened:
Selection moves to
dup x = (x, x)
two lines below. Alt-p selects the entirething h = ...
definition, requiring these movements to get back toputStr
:Alt-i
Alt-n
Alt-n
Alt-n
Alt-i
Alt-n
Alt-i
Alt-n
Alt-i
Alt-n
Alt-n
Helix log
No response
Platform
Linux
Terminal Emulator
alacritty 0.10.1
Helix Version
helix 22.05 (27609f5)
The text was updated successfully, but these errors were encountered: