Skip to content

Use move_cursor instead of select_node#206

Merged
Maxteabag merged 1 commit into
Maxteabag:mainfrom
eibx:feature/move-cursor
May 22, 2026
Merged

Use move_cursor instead of select_node#206
Maxteabag merged 1 commit into
Maxteabag:mainfrom
eibx:feature/move-cursor

Conversation

@eibx
Copy link
Copy Markdown
Contributor

@eibx eibx commented May 20, 2026

Thank you for your great work 👍 sqlit is such a joy to use!


When filtering the "Explorer" tree it currently uses select_node for each match, which results in the node expanding and collapsing each time.

The change I've made is to use move_cursor instead.

Before and after:

demo1.mp4

@Maxteabag
Copy link
Copy Markdown
Owner

Nice fix. Thanks.

@Maxteabag Maxteabag merged commit bc04fa4 into Maxteabag:main May 22, 2026
koianaoki pushed a commit to koianaoki/sqlit that referenced this pull request May 22, 2026
Tree.move_cursor reads node._line, which is only set during the next
layout pass — not when add() runs. Calling it synchronously right
after the snapshot restore in action_tree_filter_close sent the cursor
to whatever node currently sat at line 0 (usually the first
connection). Defer the move via call_after_refresh.

Also adds move_cursor to the test MockTree so the existing filter
tests stop AttributeError-ing after PR Maxteabag#206.
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