]> git.lizzy.rs Git - micro.git/blobdiff - internal/display/bufwindow.go
Support for highlighting all search matches (hlsearch) (#1762)
[micro.git] / internal / display / bufwindow.go
index eadf4b8f66120761888abe030593984e24f57286..e1db946e1c93668c1439de110b84cc902bd8aeac 100644 (file)
@@ -487,10 +487,17 @@ func (w *BufWindow) displayBuffer() {
                draw := func(r rune, combc []rune, style tcell.Style, highlight bool, showcursor bool) {
                        if nColsBeforeStart <= 0 && vloc.Y >= 0 {
                                if highlight {
+                                       if w.Buf.HighlightSearch && w.Buf.SearchMatch(bloc) {
+                                               style = config.DefStyle.Reverse(true)
+                                               if s, ok := config.Colorscheme["hlsearch"]; ok {
+                                                       style = s
+                                               }
+                                       }
+
                                        _, origBg, _ := style.Decompose()
                                        _, defBg, _ := config.DefStyle.Decompose()
 
-                                       // syntax highlighting with non-default background takes precedence
+                                       // syntax or hlsearch highlighting with non-default background takes precedence
                                        // over cursor-line and color-column
                                        dontOverrideBackground := origBg != defBg