Skip to content

rust-explorer: typing a name in the list selects the matching row (#130) - #167

Open
GuilhermeProvenci wants to merge 1 commit into
Lemxy:mainfrom
GuilhermeProvenci:fix/explorer-type-ahead
Open

GuilhermeProvenci wants to merge 1 commit into
Lemxy:mainfrom
GuilhermeProvenci:fix/explorer-type-ahead

Conversation

@GuilhermeProvenci

Copy link
Copy Markdown
Contributor

Fixes #130.

Problem. In the file manager, typing the start of a name does not go to that item: every letter lands on the first row.

Cause. The folder list is a virtual list view (LVS_OWNERDATA), so the control has no items of its own to search. It asks its parent with LVN_ODFINDITEM, and nothing answered it, so the answer was always row 0.

Fix. find_row answers the notification: the first row at or after the current one whose name begins with what was typed, case ignored, wrapping round to the top. The date-group heading rows (Group by date) never match. No match returns -1, so the selection stays where it is.

Test. cargo test -p rust-explorer (new typing_a_name_finds_the_row_not_the_first_one: first letter, case, start row and wrap, accents, no match, empty, stale start row). By hand: open a folder, type the first letters of a name; typing quickly keeps extending the prefix (the list view does that).

I have not tested the desktop view (it is not virtual and the list view handles it itself) or a folder with thousands of rows.

🤖 Generated with Claude Code

…mxy#130)

The folder list is virtual (LVS_OWNERDATA), so the list view has no items of its own to search and asks the parent with
LVN_ODFINDITEM. Nothing answered, and every typed letter landed on the first row.

find_row answers it: the first row at or after the current one whose name starts with what was typed, case ignored, wrapping
round to the top; the date-group heading rows never match. -1 (no match) leaves the selection where it is.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.

Typing into Explorer doesn't take you to the folder you typed.

1 participant