Skip to content

Commit 0aa398f

Browse files
committed
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Problem: wrong highlighting with combination of match and 'cursorline'. Solution: Use "line_attr" when appropriate. (Ozaki Kiichi, closes #2111) But don't highlight more than one character.
1 parent 3a497e1 commit 0aa398f

File tree

4 files changed

+491
-2
lines changed

4 files changed

+491
-2
lines changed

src/screen.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4168,6 +4168,9 @@ win_line(
41684168
if (shl != &search_hl && cur != NULL)
41694169
cur = cur->next;
41704170
}
4171+
/* Only highlight one character after the last column. */
4172+
if (*ptr == NUL && did_line_attr >= 1)
4173+
search_attr = 0;
41714174
}
41724175
#endif
41734176

@@ -5064,7 +5067,9 @@ win_line(
50645067
++did_line_attr;
50655068

50665069
/* don't do search HL for the rest of the line */
5067-
if (line_attr != 0 && char_attr == search_attr && col > 0)
5070+
if (line_attr != 0 && char_attr == search_attr
5071+
&& (did_line_attr > 1
5072+
|| (wp->w_p_list && lcs_eol > 0)))
50685073
char_attr = line_attr;
50695074
# ifdef FEAT_DIFF
50705075
if (diff_hlf == HLF_TXD)
@@ -5320,6 +5325,13 @@ win_line(
53205325
#ifdef FEAT_SEARCH_EXTRA
53215326
/* highlight 'hlsearch' match at end of line */
53225327
|| (prevcol_hl_flag == TRUE
5328+
# ifdef FEAT_SYN_HL
5329+
&& !(wp->w_p_cul && lnum == wp->w_cursor.lnum
5330+
&& !(wp == curwin && VIsual_active))
5331+
# endif
5332+
# ifdef FEAT_DIFF
5333+
&& diff_hlf == (hlf_T)0
5334+
# endif
53235335
# if defined(LINE_ATTR)
53245336
&& did_line_attr <= 1
53255337
# endif

0 commit comments

Comments
 (0)