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

Fix several minor search bugs relating to incsearch highlighting and Visual mode #1080

Draft
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

citizenmatt
Copy link
Member

@citizenmatt citizenmatt commented Jan 4, 2025

This PR fixes a number of bugs related to 'incsearch' highlighting while searching in Visual mode, e.g. v/foo

  • Fixes an issue where 'incsearch' would not correctly update an empty selection, when 'selection' was set to "exclusive". So something like ve/foo would work but v/foo would not update the selection. The selection would be correctly set when completing the search with <CR>
  • This also fixed an issue with correctly updating the selection when the search pattern was changed, such as editing it from /foo to /faa
  • Don't show 'incsearch' highlighting when 'nohlsearch' is set and Visual mode is active. Normally, 'incsearch' highlighting is shown for the current match, even when 'hlsearch' is disabled, but it's not shown if Visual mode is active - the selection is enough
  • Exit Visual mode when 'incsearch' needs to move the caret for a Command-line command, rather than a search. E.g. something like ve:<C-U>normal 3j should not maintain the Visual selection, but ve/foo should

It also removes some obsolete tests using the no longer used 'usenewregex' option, and splits up the search related tests into SearchGroupTest.kt, IncsearchTests.kt, SearchHighlightsTest.kt, etc.

This PR depends on the Mode refactoring in #1078 and includes all of those commits. To make it easier for me to manage, it's also based on #1079. Once these PRs are merged, I will rebase and force push and mark this PR as no longer draft. Here are the lists of commits for this PR: 5275057...f31fde9

Wanting to add `ReturnTo.SELECT` would be very tricky, as we would have to recreate the mode, but have no details about the selection type.
From Select mode, enters Visual for a single command
As a by-product, this also fixes an off-by-one error where incsearch would effectively treat all Visual searches as exclusive
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.

1 participant