Skip to content
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

A-n, A-p, A-o, A-i all don't have have consistent selection "orientations" #4612

Closed
emilyyyylime opened this issue Nov 6, 2022 · 5 comments
Labels
A-helix-term Area: Helix term improvements E-easy Call for participation: Experience needed to fix: Easy / not much E-good-first-issue Call for participation: Issues suitable for new contributors E-help-wanted Call for participation: Extra attention is needed

Comments

@emilyyyylime
Copy link
Contributor

What I mean by the selections' orientation is the relative order of the cursor and the anchor.

I think it's important for movement operations to be consistent in their orientation because it lets me better string together multiple operations without having to actively look out for where my cursor is.

Furthermore, if I'm using A-n etc. to navigate the document I usually want/expect the object I'm moving into to come into focus, while the current behaviour seems to "prefer" not moving document around at all.

@kirawi kirawi added the A-helix-term Area: Helix term improvements label Nov 6, 2022
@the-mikedavis
Copy link
Member

The current behavior is to inherit the direction from the original selection:

if range.head < range.anchor {
Range::new(to, from)
} else {
Range::new(from, to)
}

What's the behavior you're looking for?

@emilyyyylime
Copy link
Contributor Author

@the-mikedavis I think next sibling and prev sibling should always be forwards and backwards, respectively.

I guess I don't actually care about direction when both nodes are on screen at once but if I'm going to a node that's mostly off-screen (say from one top-level function to the next), I'd want it to become mostly on screen, not just to see a little sliver of it selected

@pascalkuthe pascalkuthe added E-easy Call for participation: Experience needed to fix: Easy / not much E-help-wanted Call for participation: Extra attention is needed E-good-first-issue Call for participation: Issues suitable for new contributors labels Apr 8, 2024
@krish-r
Copy link
Contributor

krish-r commented Apr 21, 2024

Range::new(from, to).with_direction(range.direction())

Does it make sense to use Direction::Backward instead of Direction::Forward / range.direction() for the following commands? This way, we can always see the start of a (long) function.

  • select_prev_sibling
  • select_next_sibling

The following Tree-sitter based commands could also benefit from using Direction::Backward instead.

  • goto_next_function
  • goto_next_class

@the-mikedavis
Copy link
Member

Always using Direction::Backward would make select mode behave oddly when that is implemented (#1999), also see #10022 (comment). select_prev_sibling should always use Direction::Backward and select_next_sibling should always use Direction::Forward instead

@the-mikedavis
Copy link
Member

Fixed in #10542

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements E-easy Call for participation: Experience needed to fix: Easy / not much E-good-first-issue Call for participation: Issues suitable for new contributors E-help-wanted Call for participation: Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants