mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-25 18:07:07 +09:00
Support for highlighting all search matches (hlsearch) (#1762)
* Support for highlighting all search matches (hlsearch) hlsearch is implemented efficiently using the buffer's line array, somewhat similarly to the syntax highlighting. Unlike the syntax highlighter which highlights the entire file, hlsearch searches for matches for the displayed lines only. Matches are searched when the given line is displayed first time or after it was modified. Otherwise the previously found matches are used. * Add UnhighlightSearch action and add it to the list of actions triggered by Esc key by default. * Add comment explaining the purpose of search map * Add hlsearch colors to colorschemes Mostly just copied from the corresponding original (mostly vim) colorschemes. * Highlight matches during/after replace as well As a side effect it also changes the last search value, i.e. affects FindNext and FindPrevious, but it's probably fine. In vim it works the same way. * Improve hlsearch option description
This commit is contained in:
@@ -226,9 +226,6 @@ type BufPane struct {
|
||||
// Same here, just to keep track for mouse move events
|
||||
tripleClick bool
|
||||
|
||||
// Last search stores the last successful search for FindNext and FindPrev
|
||||
lastSearch string
|
||||
lastSearchRegex bool
|
||||
// Should the current multiple cursor selection search based on word or
|
||||
// based on selection (false for selection, true for word)
|
||||
multiWord bool
|
||||
@@ -683,6 +680,8 @@ var BufKeyActions = map[string]BufKeyAction{
|
||||
"ToggleKeyMenu": (*BufPane).ToggleKeyMenu,
|
||||
"ToggleDiffGutter": (*BufPane).ToggleDiffGutter,
|
||||
"ToggleRuler": (*BufPane).ToggleRuler,
|
||||
"ToggleHighlightSearch": (*BufPane).ToggleHighlightSearch,
|
||||
"UnhighlightSearch": (*BufPane).UnhighlightSearch,
|
||||
"ClearStatus": (*BufPane).ClearStatus,
|
||||
"ShellMode": (*BufPane).ShellMode,
|
||||
"CommandMode": (*BufPane).CommandMode,
|
||||
|
||||
Reference in New Issue
Block a user