Skip to content

Fix selection/offset reset on filter change#11

Closed
walldmtd wants to merge 1 commit intoMjoyufull:mainfrom
walldmtd:main
Closed

Fix selection/offset reset on filter change#11
walldmtd wants to merge 1 commit intoMjoyufull:mainfrom
walldmtd:main

Conversation

@walldmtd
Copy link
Contributor

This makes it so the selection and scroll offset are reset on any change to the filter query (typing or backspace). This is also similar to rofi.

Before, the selected row number would stay the same when the filter changed, and would only reset when list got shorter than the selected row. If this was intentional, I would still recommend changing it since it doesn't make sense to leave the selection in place when its value is changing anyway.

@Mjoyufull
Copy link
Owner

this was in fact kinda sorta intended but i think your approach is much better and will be merged internally as i am refactoring how commits and pr's are done to the project and doing an internal refactor for ease of commits for the projects.
feel free to reopen post refactor, i decided to refactor whilst offline and it was too late to make a pr and i just continued, things will improve and be more clear from now on.
thank you for your addition to the project i hope for continued contributions.

@Mjoyufull Mjoyufull closed this Oct 27, 2025
@Mjoyufull Mjoyufull requested review from Mjoyufull and removed request for Mjoyufull October 27, 2025 02:48
@walldmtd
Copy link
Contributor Author

No worries, if it's getting merged internally then I don't mind having the PR closed. Good luck with the refactor!

Mjoyufull pushed a commit that referenced this pull request Oct 29, 2025
fix: replace old selection reset logic in app_ui.rs

Completes the selection reset refactor from PR #11.
Replaced outdated conditional selection reset logic with cleaner
approach that resets selection whenever filter changes.

- Removed nested if/else blocks checking current_selected
- Simplified to single reset when shown.is_empty()
- Selection now properly resets to first item on filter change
- Behavior now consistent with rest of codebase

authored-by: @walldmtd pr #16

Closes #16
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