patch 8.2.4724: current instance of last search pattern not easily spotted
Problem: Current instance of last search pattern not easily spotted.
Solution: Add CurSearch highlighting. (closes #10133)
diff --git a/src/match.c b/src/match.c
index ce35bac..d74d8d7 100644
--- a/src/match.c
+++ b/src/match.c
@@ -652,6 +652,7 @@
shl = &cur->hl;
shl->startcol = MAXCOL;
shl->endcol = MAXCOL;
+ shl->lines = 0;
shl->attr_cur = 0;
shl->is_addpos = FALSE;
if (cur != NULL)
@@ -674,6 +675,10 @@
shl->endcol = shl->rm.endpos[0].col;
else
shl->endcol = MAXCOL;
+ if (shl->rm.endpos[0].lnum != shl->rm.startpos[0].lnum)
+ shl->lines = shl->rm.endpos[0].lnum - shl->rm.startpos[0].lnum;
+ else
+ shl->lines = 1;
// Highlight one character for an empty match.
if (shl->startcol == shl->endcol)
{
@@ -768,6 +773,17 @@
else
*has_match_conc = 0;
# endif
+ // Highlight the match were the cursor is using the CurSearch
+ // group.
+ if (shl == search_hl
+ && wp->w_cursor.lnum >= shl->lnum
+ && wp->w_cursor.lnum < shl->lnum + shl->lines
+ && wp->w_cursor.col >= shl->startcol
+ && wp->w_cursor.col < shl->endcol)
+ {
+ shl->attr_cur = HL_ATTR(HLF_LC);
+ }
+
}
else if (col == shl->endcol)
{