Skip to content

Fix tree restricted search infinite wrap - #1371

Merged
flyingmutant merged 2 commits into
cmus:masterfrom
pgaskin:fix-tree-search-infinite-wrap
Sep 23, 2024
Merged

flyingmutant merged 2 commits into
cmus:masterfrom
pgaskin:fix-tree-search-infinite-wrap

Conversation

@pgaskin

@pgaskin pgaskin commented Sep 22, 2024

Copy link
Copy Markdown
Member

fixes #1332

This is needed for cases where get_prev/get_next may skip items
depending on the direction.
@pgaskin

pgaskin commented Sep 22, 2024

Copy link
Copy Markdown
Member Author

@flyingmutant, this should be rebase-merged to keep the refactor separate from the fix.

@pgaskin pgaskin changed the title Fix tree search infinite wrap Fix tree restricted search infinite wrap Sep 22, 2024
Comment thread tree.c Resolved
This happens when:
- Using forward/reverse tree (view=1, i.e., tree_search_ops)
  restricted search (`//` or `??`, i.e., cmd_search_start or
  cmd_search_b_start with search_restricted=1).
- The currently selected item (because search beginning=0) is not the
  first/last track for forwards/backwards search respectively.
- Wrapping is enabled (i.e., wrap_search=1).
- No match is found for the search query.

The initial iter from get_current (i.e., the currently selected track)
is never identical to the one from get_prev/get_next since it only
considers the first/last track of each album, causing it to keep
searching indefinitely.
@pgaskin
pgaskin force-pushed the fix-tree-search-infinite-wrap branch from ec5f9da to e8ef999 Compare September 23, 2024 00:34
@pgaskin
pgaskin requested a review from gavtroy September 23, 2024 00:36
@flyingmutant

Copy link
Copy Markdown
Member

@flyingmutant, this should be rebase-merged to keep the refactor separate from the fix.

Don't worry, I'll default to rebase-merge all your PRs. I don't like squashing in general, but sometimes PR commit history is just too hairy for a rebase.

@flyingmutant
flyingmutant merged commit 084db8d into cmus:master Sep 23, 2024
@pgaskin

pgaskin commented Sep 24, 2024

Copy link
Copy Markdown
Member Author

Okay, thanks 😉. Probably do the same for @gavtroy's as well since those are also logically split into independent commits.

@pgaskin
pgaskin deleted the fix-tree-search-infinite-wrap branch September 24, 2024 03:33
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.

search, keyboard stops to respond after typing 4 slashes

3 participants