Skip to content

Simplify (hopefully) code for moving selection in filetreelist #2645

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

Merged

Conversation

cruessler
Copy link
Collaborator

This is a potential follow-up to #2496.

It changes the following:

  • It adds get_new_selection as the single function that iterates over the list’s items to get the next selection based on a range and a step size.
  • It adds enum Direction as a more explicit alternative to up: bool.
  • It removes some loops in favor of iterators and their APIs.
  • It removes some duplication with respect to whether the new index is different than the current one.

The only thing I’m worried about is that the ranges passed as arguments to get_new_selection potentially are too clever or unintuitive. If you think that’s an argument against this PR as a whole, feel free to close it! 😄 I still wanted to open it in order to get your feedback.

I followed the checklist:

  • I ran make check without errors
  • I tested the overall application

@cruessler cruessler force-pushed the simplify-arrow-up-and-arrow-down branch from 5593c2f to 0153e56 Compare May 20, 2025 07:01
@extrawurst
Copy link
Collaborator

looks good to me!

@extrawurst extrawurst merged commit 3b22a4f into gitui-org:master May 20, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants