Keep search selection followed on confirm#2003
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughKeep search selection followed on confirmChanges: Update to MainPanel_eventHandler (MainPanel.c) to preserve the selected process row when confirming an incremental (non-filter) search. Implementation: Snapshot pre-call state and compute two conditions around IncSet_handleKey:
When either activeSearchMatch or confirmedSearch is true, the handler:
Problem solved: Prevents losing the searched/selected row when exiting incremental search (which could move the cursor during table rebuilds, notably in sorted tree views). Quality: Single, focused and localized change with clear variable naming and minimal surface area. No API changes. Commit appears logically scoped and in‑line with existing state-machine handling. Lines changed: +8/-1 WalkthroughThis PR updates MainPanel_eventHandler to snapshot whether the pre-key state was a non-filter incremental search, call IncSet_handleKey, then distinguish a continued active-search match from an Enter-confirmed search exit. If either condition holds it sets host->activeTable->following to the selected row, changes selection color to PANEL_SELECTION_FOLLOW, and sets HTOP_KEEP_FOLLOWING. If the transition is the Enter-confirmed exit it also sets HTOP_REFRESH. Poem
Comment |
BenBE
left a comment
There was a problem hiding this comment.
One minor idea to avoid a bit of code duplication; no need to implement, but open to hear opinions. Apart from that LGTM.
e67b881 to
91a8641
Compare
91a8641 to
3b4eb98
Compare
3b4eb98 to
ba9964f
Compare
ba9964f to
c971ad5
Compare
c971ad5 to
7d7baeb
Compare
Summary
When confirming an active incremental search, keep the selected process as the table's followed row before refreshing the main panel.
This preserves the searched/selected row across the refresh that happens when leaving search mode, including sorted tree view setups where a rebuild can otherwise move the cursor to an unexpected row.
Testing
./autogen.sh && ./configuremake -j32make checkgit diff --checkAI disclosure
This patch was prepared with assistance from OpenAI Codex and reviewed before submission.