Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add per view search location and total matches to statusline. #11700

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

useche
Copy link
Contributor

@useche useche commented Sep 14, 2024

This patch changes search_impl to calculate the index of the current match and the total matches in the search. It also adds a new option in the status line to show this information.

This patch changes `search_impl` to calculate the index of the current
match and the total matches in the search. It also adds a new option in
the status line to show this information.
@Axlefublr
Copy link
Contributor

love this, was clearly missing

@kirawi kirawi added A-gui Area: Helix gui improvements A-command Area: Commands labels Sep 28, 2024
Comment on lines +2149 to +2153
let (idx, mat) = mat.unwrap();
let last_idx = match all_matches.last() {
None => idx,
Some((last_idx, _)) => last_idx,
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is inefficient and also the reason we didn't implement it in the first place: it requires scanning through the entire document just to find a total count, and this is a significant hit on very large files/lots of matches. (Because of this vim only says 99+ if there's more than 100 matches).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-command Area: Commands A-gui Area: Helix gui improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants