From 33486c8ebd57074d9c92c4de06ea4dcab573c01e Mon Sep 17 00:00:00 2001 From: Yichao Zhou Date: Wed, 11 May 2016 19:16:07 -0700 Subject: Let the highlight of listchars override cursorline Closes #3670 --- src/nvim/screen.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 10b5b6bba4..a1f74279ce 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -3402,11 +3402,9 @@ win_line ( if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ') { c = lcs_trail; - if (!attr_pri) { - n_attr = 1; - extra_attr = hl_attr(HLF_8); - saved_attr2 = char_attr; /* save current attr */ - } + n_attr = 1; + extra_attr = hl_attr(HLF_8); + saved_attr2 = char_attr; /* save current attr */ mb_c = c; if (enc_utf8 && (*mb_char2len)(c) > 1) { mb_utf8 = TRUE; @@ -3555,10 +3553,8 @@ win_line ( } lcs_eol_one = -1; --ptr; /* put it back at the NUL */ - if (!attr_pri) { - extra_attr = hl_attr(HLF_AT); - n_attr = 1; - } + extra_attr = hl_attr(HLF_AT); + n_attr = 1; mb_c = c; if (enc_utf8 && (*mb_char2len)(c) > 1) { mb_utf8 = TRUE; @@ -3587,11 +3583,9 @@ win_line ( n_extra = byte2cells(c) - 1; c = *p_extra++; } - if (!attr_pri) { - n_attr = n_extra + 1; - extra_attr = hl_attr(HLF_8); - saved_attr2 = char_attr; /* save current attr */ - } + n_attr = n_extra + 1; + extra_attr = hl_attr(HLF_8); + saved_attr2 = char_attr; /* save current attr */ mb_utf8 = FALSE; /* don't draw as UTF-8 */ } else if (VIsual_active && (VIsual_mode == Ctrl_V @@ -3703,10 +3697,8 @@ win_line ( } /* Don't override visual selection highlighting. */ - if (n_attr > 0 - && draw_state == WL_LINE - && !attr_pri) - char_attr = extra_attr; + if (n_attr > 0 && draw_state == WL_LINE) + char_attr = hl_combine_attr(char_attr, extra_attr); /* * Handle the case where we are in column 0 but not on the first -- cgit From 391d8ff3d8d2edfe56f7d14baddec7ddc38466ae Mon Sep 17 00:00:00 2001 From: Yichao Zhou Date: Sat, 14 May 2016 00:24:41 -0700 Subject: lint --- src/nvim/screen.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index a1f74279ce..7d358ab7b6 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -3404,7 +3404,7 @@ win_line ( c = lcs_trail; n_attr = 1; extra_attr = hl_attr(HLF_8); - saved_attr2 = char_attr; /* save current attr */ + saved_attr2 = char_attr; // save current attr mb_c = c; if (enc_utf8 && (*mb_char2len)(c) > 1) { mb_utf8 = TRUE; @@ -3552,7 +3552,7 @@ win_line ( c = ' '; } lcs_eol_one = -1; - --ptr; /* put it back at the NUL */ + ptr--; // put it back at the NUL extra_attr = hl_attr(HLF_AT); n_attr = 1; mb_c = c; @@ -3585,8 +3585,8 @@ win_line ( } n_attr = n_extra + 1; extra_attr = hl_attr(HLF_8); - saved_attr2 = char_attr; /* save current attr */ - mb_utf8 = FALSE; /* don't draw as UTF-8 */ + saved_attr2 = char_attr; // save current attr + mb_utf8 = false; // don't draw as UTF-8 } else if (VIsual_active && (VIsual_mode == Ctrl_V || VIsual_mode == 'v') @@ -3696,9 +3696,10 @@ win_line ( did_wcol = true; } - /* Don't override visual selection highlighting. */ - if (n_attr > 0 && draw_state == WL_LINE) + // Don't override visual selection highlighting. + if (n_attr > 0 && draw_state == WL_LINE) { char_attr = hl_combine_attr(char_attr, extra_attr); + } /* * Handle the case where we are in column 0 but not on the first @@ -3726,13 +3727,12 @@ win_line ( mb_utf8 = TRUE; u8cc[0] = 0; c = 0xc0; - } else - mb_utf8 = FALSE; /* don't draw as UTF-8 */ - if (!attr_pri) { - saved_attr3 = char_attr; /* save current attr */ - char_attr = hl_attr(HLF_AT); /* later copied to char_attr */ - n_attr3 = 1; + } else { + mb_utf8 = false; // don't draw as UTF-8 } + saved_attr3 = char_attr; // save current attr + char_attr = hl_attr(HLF_AT); // later copied to char_attr + n_attr3 = 1; } /* -- cgit From 4eb4a5cdb2f022a6a5ceb81fe615a259191ec2d9 Mon Sep 17 00:00:00 2001 From: Yichao Zhou Date: Sun, 15 May 2016 21:53:15 -0700 Subject: screen.c: Fix listchars hl for space/nbsp in visual mode. --- src/nvim/screen.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 7d358ab7b6..34eef83164 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -3385,11 +3385,9 @@ win_line ( && lcs_nbsp) || (c == ' ' && lcs_space && ptr - line <= trailcol))) { c = (c == ' ') ? lcs_space : lcs_nbsp; - if (area_attr == 0 && search_attr == 0) { - n_attr = 1; - extra_attr = hl_attr(HLF_8); - saved_attr2 = char_attr; // save current attr - } + n_attr = 1; + extra_attr = hl_attr(HLF_8); + saved_attr2 = char_attr; // save current attr mb_c = c; if (enc_utf8 && (*mb_char2len)(c) > 1) { mb_utf8 = true; -- cgit