diff options
Diffstat (limited to 'src/nvim/match.c')
-rw-r--r-- | src/nvim/match.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/nvim/match.c b/src/nvim/match.c index 4129e84fc2..256e5812d4 100644 --- a/src/nvim/match.c +++ b/src/nvim/match.c @@ -582,6 +582,7 @@ bool prepare_search_hl_line(win_T *wp, linenr_T lnum, colnr_T mincol, char_u **l } shl->startcol = MAXCOL; shl->endcol = MAXCOL; + shl->lines = 0; shl->attr_cur = 0; shl->is_addpos = false; if (cur != NULL) { @@ -606,6 +607,11 @@ bool prepare_search_hl_line(win_T *wp, linenr_T lnum, colnr_T mincol, char_u **l } 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) { if ((*line)[shl->endcol] != NUL) { @@ -668,10 +674,12 @@ int update_search_hl(win_T *wp, linenr_T lnum, colnr_T col, char_u **line, match if (shl->endcol < next_col) { shl->endcol = next_col; } - // Use "CurSearch" highlight for current search match + // Highlight the match were the cursor is using the CurSearch + // group. if (shl == search_hl && (HL_ATTR(HLF_LC) || wp->w_hl_ids[HLF_LC]) && wp->w_cursor.lnum == lnum + && wp->w_cursor.lnum < shl->lnum + shl->lines && wp->w_cursor.col >= shl->startcol && wp->w_cursor.col < shl->endcol) { shl->attr_cur = win_hl_attr(wp, HLF_LC) ? win_hl_attr(wp, HLF_LC) : HL_ATTR(HLF_LC); |