Preserve EntryView scroll and selection state when switching databases in search mode #12232
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: Preserve EntryView Scroll and Selection State in Search Mode
Description
This pull request fixes a long-standing issue where the entry list scroll position and selection jump to the wrong location when switching between open databases in search mode, especially if sorting is set to anything other than "Group." The bug is described in detail in #12001.
Problem
When switching between databases with search active, the entry view always resets sort order to "Group" and selects the first entry, ignoring the user's prior sort and selection. This causes the scroll position to jump unexpectedly, breaking user workflow and expectations.
Solution
This change ensures consistent and expected navigation when using multiple databases, search mode, and custom sort orders.
Steps to Reproduce (Before Fix)
See #12001 for detailed steps and screenshots.
Testing strategy
Type of change
Additional Notes
AI Assistance Disclosure
Parts of this contribution were generated or reviewed using GitHub Copilot (OpenAI GPT-4o), an AI service, to assist with code search, patch suggestion, and documentation refinement. All code was written and fully reviewed by the contributor before submission, in accordance with KeePassXC's contributing guidelines.