Forked from DeaR/CursorLine_overrides_SpecialKey_ver2.patch
Last active
May 9, 2022 02:49
-
-
Save presuku/d3d6b230b9b6dcfc0477 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r 661e95466448 src/screen.c | |
--- a/src/screen.c Sun Nov 23 15:57:49 2014 +0100 | |
+++ b/src/screen.c Wed Nov 26 14:19:18 2014 +0900 | |
@@ -2994,7 +2994,7 @@ | |
int syntax_flags = 0; | |
int syntax_seqnr = 0; | |
int prev_syntax_id = 0; | |
- int conceal_attr = hl_attr(HLF_CONCEAL); | |
+ int conceal_attr = 0; | |
int is_concealing = FALSE; | |
int boguscols = 0; /* nonexistent columns added to force | |
wrapping */ | |
@@ -4147,12 +4147,9 @@ | |
mb_utf8 = (c >= 0x80); | |
n_extra = (int)STRLEN(p_extra); | |
c_extra = NUL; | |
- if (area_attr == 0 && search_attr == 0) | |
- { | |
- 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 */ | |
} | |
else if (mb_l == 0) /* at the NUL at end-of-line */ | |
mb_l = 1; | |
@@ -4279,12 +4276,9 @@ | |
) && lcs_nbsp) | |
{ | |
c = 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 */ | |
#ifdef FEAT_MBYTE | |
mb_c = c; | |
if (enc_utf8 && (*mb_char2len)(c) > 1) | |
@@ -4334,10 +4328,6 @@ | |
line = ml_get_buf(wp->w_buffer, lnum, FALSE); | |
ptr = line + v; | |
- if (!attr_pri) | |
- char_attr = syntax_attr; | |
- else | |
- char_attr = hl_combine_attr(syntax_attr, char_attr); | |
# ifdef FEAT_CONCEAL | |
/* no concealing past the end of the line, it interferes | |
* with line highlighting */ | |
@@ -4477,12 +4467,9 @@ | |
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 */ | |
#ifdef FEAT_MBYTE | |
mb_c = c; | |
if (enc_utf8 && (*mb_char2len)(c) > 1) | |
@@ -4657,11 +4644,8 @@ | |
c = ' '; | |
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; | |
#ifdef FEAT_MBYTE | |
mb_c = c; | |
if (enc_utf8 && (*mb_char2len)(c) > 1) | |
@@ -4702,12 +4686,9 @@ | |
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 */ | |
#ifdef FEAT_MBYTE | |
mb_utf8 = FALSE; /* don't draw as UTF-8 */ | |
#endif | |
@@ -4780,7 +4761,7 @@ | |
&& !(lnum_in_visual_area | |
&& vim_strchr(wp->w_p_cocu, 'v') == NULL)) | |
{ | |
- char_attr = conceal_attr; | |
+ conceal_attr = hl_attr(HLF_CONCEAL); | |
if (prev_syntax_id != syntax_seqnr | |
&& (syn_get_sub_char() != NUL || wp->w_p_cole == 1) | |
&& wp->w_p_cole != 3) | |
@@ -4838,6 +4819,7 @@ | |
{ | |
prev_syntax_id = 0; | |
is_concealing = FALSE; | |
+ conceal_attr = 0; | |
} | |
#endif /* FEAT_CONCEAL */ | |
} | |
@@ -4858,9 +4840,42 @@ | |
/* Don't override visual selection highlighting. */ | |
if (n_attr > 0 | |
- && draw_state == WL_LINE | |
- && !attr_pri) | |
- char_attr = extra_attr; | |
+ && draw_state == WL_LINE) | |
+ { | |
+ if (!attr_pri) | |
+ char_attr = extra_attr; | |
+ else | |
+ char_attr = hl_combine_attr(extra_attr, char_attr); | |
+ } | |
+#ifdef FEAT_CONCEAL | |
+ else if (conceal_attr > 0) | |
+ { | |
+ if (!attr_pri) | |
+ char_attr = conceal_attr; | |
+ else | |
+ char_attr = hl_combine_attr(conceal_attr, char_attr); | |
+ } | |
+#endif | |
+ else if (extra_check) | |
+ { | |
+#ifdef FEAT_SYN_HL | |
+ /* Get syntax attribute, unless still at the start of the line | |
+ * (double-wide char that doesn't fit). */ | |
+ v = (long)(ptr - line); | |
+ if (has_syntax && v > 0) | |
+ { | |
+ /* Need to get the line again, a multi-line regexp may | |
+ * have made it invalid. */ | |
+ line = ml_get_buf(wp->w_buffer, lnum, FALSE); | |
+ ptr = line + v; | |
+ | |
+ if (!attr_pri) | |
+ char_attr = syntax_attr; | |
+ else | |
+ char_attr = hl_combine_attr(syntax_attr, char_attr); | |
+ } | |
+#endif | |
+ } | |
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) | |
/* XIM don't send preedit_start and preedit_end, but they send |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r 661e95466448 src/screen.c | |
--- a/src/screen.c Sun Nov 23 15:57:49 2014 +0100 | |
+++ b/src/screen.c Wed Nov 26 14:14:23 2014 +0900 | |
@@ -2994,7 +2994,7 @@ | |
int syntax_flags = 0; | |
int syntax_seqnr = 0; | |
int prev_syntax_id = 0; | |
- int conceal_attr = hl_attr(HLF_CONCEAL); | |
+ int conceal_attr = 0; | |
int is_concealing = FALSE; | |
int boguscols = 0; /* nonexistent columns added to force | |
wrapping */ | |
@@ -4147,12 +4147,9 @@ | |
mb_utf8 = (c >= 0x80); | |
n_extra = (int)STRLEN(p_extra); | |
c_extra = NUL; | |
- if (area_attr == 0 && search_attr == 0) | |
- { | |
- 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 */ | |
} | |
else if (mb_l == 0) /* at the NUL at end-of-line */ | |
mb_l = 1; | |
@@ -4279,12 +4276,9 @@ | |
) && lcs_nbsp) | |
{ | |
c = 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 */ | |
#ifdef FEAT_MBYTE | |
mb_c = c; | |
if (enc_utf8 && (*mb_char2len)(c) > 1) | |
@@ -4329,15 +4323,6 @@ | |
else | |
did_emsg = save_did_emsg; | |
- /* Need to get the line again, a multi-line regexp may | |
- * have made it invalid. */ | |
- line = ml_get_buf(wp->w_buffer, lnum, FALSE); | |
- ptr = line + v; | |
- | |
- if (!attr_pri) | |
- char_attr = syntax_attr; | |
- else | |
- char_attr = hl_combine_attr(syntax_attr, char_attr); | |
# ifdef FEAT_CONCEAL | |
/* no concealing past the end of the line, it interferes | |
* with line highlighting */ | |
@@ -4477,12 +4462,9 @@ | |
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 */ | |
#ifdef FEAT_MBYTE | |
mb_c = c; | |
if (enc_utf8 && (*mb_char2len)(c) > 1) | |
@@ -4657,11 +4639,8 @@ | |
c = ' '; | |
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; | |
#ifdef FEAT_MBYTE | |
mb_c = c; | |
if (enc_utf8 && (*mb_char2len)(c) > 1) | |
@@ -4702,12 +4681,9 @@ | |
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 */ | |
#ifdef FEAT_MBYTE | |
mb_utf8 = FALSE; /* don't draw as UTF-8 */ | |
#endif | |
@@ -4780,7 +4756,7 @@ | |
&& !(lnum_in_visual_area | |
&& vim_strchr(wp->w_p_cocu, 'v') == NULL)) | |
{ | |
- char_attr = conceal_attr; | |
+ conceal_attr = hl_attr(HLF_CONCEAL); | |
if (prev_syntax_id != syntax_seqnr | |
&& (syn_get_sub_char() != NUL || wp->w_p_cole == 1) | |
&& wp->w_p_cole != 3) | |
@@ -4838,6 +4814,7 @@ | |
{ | |
prev_syntax_id = 0; | |
is_concealing = FALSE; | |
+ conceal_attr = 0; | |
} | |
#endif /* FEAT_CONCEAL */ | |
} | |
@@ -4858,9 +4835,39 @@ | |
/* Don't override visual selection highlighting. */ | |
if (n_attr > 0 | |
- && draw_state == WL_LINE | |
- && !attr_pri) | |
- char_attr = extra_attr; | |
+ && draw_state == WL_LINE) | |
+ { | |
+ if (!attr_pri) | |
+ char_attr = extra_attr; | |
+ else | |
+ char_attr = hl_combine_attr(char_attr, extra_attr); | |
+ } | |
+#ifdef FEAT_CONCEAL | |
+ else if (conceal_attr > 0) | |
+ { | |
+ char_attr = conceal_attr; | |
+ } | |
+#endif | |
+ else if (extra_check) | |
+ { | |
+#ifdef FEAT_SYN_HL | |
+ /* Get syntax attribute, unless still at the start of the line | |
+ * (double-wide char that doesn't fit). */ | |
+ v = (long)(ptr - line); | |
+ if (has_syntax && v > 0) | |
+ { | |
+ /* Need to get the line again, a multi-line regexp may | |
+ * have made it invalid. */ | |
+ line = ml_get_buf(wp->w_buffer, lnum, FALSE); | |
+ ptr = line + v; | |
+ | |
+ if (!attr_pri) | |
+ char_attr = syntax_attr; | |
+ else | |
+ char_attr = hl_combine_attr(syntax_attr, char_attr); | |
+ } | |
+#endif | |
+ } | |
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) | |
/* XIM don't send preedit_start and preedit_end, but they send |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I wonder if this fix is ever going to make it to a release?