Search fixes/improvements (show match count) #1466
Open
+265
−64
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Content:
This PR fixes one small bug in highlighting and adds two new features.
Fixes a case where highlighting does not match actual search.
How to reproduce: Have a word with capital letters and one all lower case, use * on the capitalized word to search for that one. The search correctly ignores case, but if smartcase is enabled the highlighting incorrectly does not highlight the lower case word.
Maybe related: VIM-3459 Regression: 'smartcase' should not affect star command
Add an option to disable highlighting many matches during incsearch
This otherwise can massively slow down searching as the IDE tries to highlight all 0s in a csv for example.
This is protected behind an option ``, but for now I have set the default to 100, WOULD BE CHANGE IN DEFAULT BEHAVIOR (setting it to -1 gets old behavior)
Related:
Add option to show matches to search in file
showmatchcountthis will display a counter and index into the matches while searching, e.g.[13/159]means 159 matches and your at or before match 13.Related:
Example:

Notice here that I'm searching for "0" in the left editor, the left file show matches because there are only 8 (see right part of command bar). The right file has 1000+ matches so shows nothing, meaning no hiccups while typing "01" for example.
Also visible in the middle bottom is the counter for matches in the files and the current index in the matches for that file.
Once you press enter the "protection" is gone, meaning to only a single slowdown in this case

After that I clicked on the right side and you can see what the search counter looks like when the entry is not active (maybe it should have a border on the left side?)
Review
Please feel free to school me on anything Kotlin, this is my first time using the languages, just tried to match the patterns I saw in other files.
Also I really tried adding tests for option 2 & 3 but I had to mock so much I gave up, if there is a good/easy way to do it would love to hear it.