Skip to content

Conversation

@stefanhaller
Copy link
Collaborator

…selection

For views that don't show the highlighted line it doesn't make sense to start
searching from the cursor position, so select the first match in that case.
One for setting the selection, and one for rendering the "match x of y" string;
we want to use them separately in the next commit.
Can be used after changing the selection in a view, to make the search result
follow.
This improves the case where the user has moved the selection to before the
first match and presses 'n', or to after the current match and presses 'N'. In
both cases we now simply jump to the current match again.
@stefanhaller stefanhaller merged commit 7b51033 into master Jan 4, 2026
1 check passed
@stefanhaller stefanhaller deleted the update-search-result-index-when-changing-selection branch January 4, 2026 17:47
stefanhaller added a commit to jesseduffield/lazygit that referenced this pull request Jan 4, 2026
…a list view (#5169)

When searching (not filtering) in a list view using `/`, moving the
selection now updates the "x of y" indicator of the search results to
the last one before the selection. Pressing `n` again searches from
there rather than from the previously shown result.

Also see corresponding gocui PR at
jesseduffield/gocui#95.
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