Repository navigation
fix(explorer): keep the highlighted nested search match on Enter - #360
Merged
Merged
Conversation
…r it While the explorer filter is open, arrow keys move the tree cursor, but Enter activated the node at _tree_filter_match_index, which only n/j advance. Enter therefore always opened the first match. Accept now uses the tree's cursor_node. After accepting, scroll the selected node to the vertical center of the explorer instead of leaving it on the bottom row. Fixes #333.
Tree.move_cursor reads node._line, which is only set during the next layout pass, not when add() runs. _jump_to_current_match called it right after each keystroke's snapshot restore, so the cursor stayed on line 0 (the connection). Now that Enter activates cursor_node, filtering to a table under a connection and pressing Enter selected the connection, and arrow presses counted from the connection row. Defer the move via call_after_refresh, as accept already does, and share that deferral in a _call_after_refresh helper. Refs #333. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #333. Integrates #335 and the follow-up from liamhawkins#1, preserving the original authors.
Enter now keeps the highlighted match after the tree is rebuilt. Cursor movement waits until Textual has assigned line numbers, including for tables nested beneath a connection.
Checked on the current main base with the explorer filter and Textual pilot tests. In the recorded SQLite terminal comparison, searching for warehouse and pressing Down twice followed by Enter selected warehouse_transfers with the combined changes.