]> git.lizzy.rs Git - micro.git/commit
Support for highlighting all search matches (hlsearch) (#1762)
authorDmitry Maluka <dmitrymaluka@gmail.com>
Tue, 28 Sep 2021 20:39:03 +0000 (22:39 +0200)
committerGitHub <noreply@github.com>
Tue, 28 Sep 2021 20:39:03 +0000 (13:39 -0700)
commitffbb25743473c2f9d78d438de5e67354bc3d51be
tree52d492d6c44e51d564b8bc7c80b968054a3f0a3c
parent9ad4437a98893504445fd44ad8b0300bedfeeb54
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
36 files changed:
internal/action/actions.go
internal/action/bufpane.go
internal/action/command.go
internal/action/defaults_darwin.go
internal/action/defaults_other.go
internal/buffer/buffer.go
internal/buffer/line_array.go
internal/buffer/settings.go
internal/config/settings.go
internal/display/bufwindow.go
runtime/colorschemes/atom-dark.micro
runtime/colorschemes/bubblegum.micro
runtime/colorschemes/cmc-16.micro
runtime/colorschemes/cmc-tc.micro
runtime/colorschemes/darcula.micro
runtime/colorschemes/default.micro
runtime/colorschemes/dracula-tc.micro
runtime/colorschemes/dukedark-tc.micro
runtime/colorschemes/dukelight-tc.micro
runtime/colorschemes/dukeubuntu-tc.micro
runtime/colorschemes/geany.micro
runtime/colorschemes/gotham.micro
runtime/colorschemes/gruvbox-tc.micro
runtime/colorschemes/gruvbox.micro
runtime/colorschemes/material-tc.micro
runtime/colorschemes/monokai-dark.micro
runtime/colorschemes/monokai.micro
runtime/colorschemes/one-dark.micro
runtime/colorschemes/railscast.micro
runtime/colorschemes/simple.micro
runtime/colorschemes/solarized-tc.micro
runtime/colorschemes/solarized.micro
runtime/colorschemes/sunny-day.micro
runtime/colorschemes/twilight.micro
runtime/colorschemes/zenburn.micro
runtime/help/options.md