0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.1.2156: first character after Tab is not highlighted

Problem:    First character after Tab is not highlighted.
Solution:   Remember the syntax attribute for a column.
This commit is contained in:
Bram Moolenaar
2019-10-16 16:57:06 +02:00
parent a3817730c0
commit 9115c611db
4 changed files with 23 additions and 11 deletions

View File

@@ -289,6 +289,8 @@ win_line(
#ifdef FEAT_SYN_HL #ifdef FEAT_SYN_HL
int vcol_save_attr = 0; // saved attr for 'cursorcolumn' int vcol_save_attr = 0; // saved attr for 'cursorcolumn'
int syntax_attr = 0; // attributes desired by syntax int syntax_attr = 0; // attributes desired by syntax
int prev_syntax_col = -1; // column of prev_syntax_attr
int prev_syntax_attr = 0; // syntax_attr at prev_syntax_col
int has_syntax = FALSE; // this buffer has syntax highl. int has_syntax = FALSE; // this buffer has syntax highl.
int save_did_emsg; int save_did_emsg;
int draw_color_col = FALSE; // highlight colorcolumn int draw_color_col = FALSE; // highlight colorcolumn
@@ -1414,12 +1416,20 @@ win_line(
did_emsg = FALSE; did_emsg = FALSE;
v = (long)(ptr - line); v = (long)(ptr - line);
if (v == prev_syntax_col)
// at same column again
syntax_attr = prev_syntax_attr;
else
{
can_spell = TRUE; can_spell = TRUE;
syntax_attr = get_syntax_attr((colnr_T)v, syntax_attr = get_syntax_attr((colnr_T)v,
# ifdef FEAT_SPELL # ifdef FEAT_SPELL
has_spell ? &can_spell : has_spell ? &can_spell :
# endif # endif
NULL, FALSE); NULL, FALSE);
prev_syntax_col = v;
prev_syntax_attr = syntax_attr;
}
// combine syntax attribute with 'wincolor' // combine syntax attribute with 'wincolor'
if (syntax_attr != 0 && win_attr != 0) if (syntax_attr != 0 && win_attr != 0)

View File

@@ -12,9 +12,9 @@
|}| @73 |}| @73
@3|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&@60 @3|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&@60
|m|y|F|u|n|c|t|i|o|n|(|c+0#00e0003&|o|n|s|t| +0#0000000&|d+0#00e0003&|o|u|b|l|e| +0#0000000&|c|o|u|n|t|,| |s+0#00e0003&|t|r|u|c|t| +0#0000000&|n|o|t|h|i|n|g|,| |l+0#00e0003&|o|n|g| +0#0000000&|t|h|e|r|e|)| |{| @14 |m|y|F|u|n|c|t|i|o|n|(|c+0#00e0003&|o|n|s|t| +0#0000000&|d+0#00e0003&|o|u|b|l|e| +0#0000000&|c|o|u|n|t|,| |s+0#00e0003&|t|r|u|c|t| +0#0000000&|n|o|t|h|i|n|g|,| |l+0#00e0003&|o|n|g| +0#0000000&|t|h|e|r|e|)| |{| @14
@2|/+0#0000e05&@1| |1+0#e000002&|2|3|:+0#0000e05&| |n|o|t|h|i|n|g| |t|o| |r|e|a|d| |h|e|r|e| +0#0000000&@44 @1| +0#0000e05&@6|/@1| |1+0#e000002&|2|3|:+0#0000e05&| |n|o|t|h|i|n|g| |t|o| |r|e|a|d| |h|e|r|e| +0#0000000&@38
@2|f+0#af5f00255&|o|r| +0#0000000&|(|i+0#00e0003&|n|t| +0#0000000&|i| |=| |0+0#e000002&|;+0#0000000&| |i| |<| |c|o|u|n|t|;| |+@1|i|)| |{| @39 @1| +0#af5f00255&@6|f|o|r| +0#0000000&|(|i+0#00e0003&|n|t| +0#0000000&|i| |=| |0+0#e000002&|;+0#0000000&| |i| |<| |c|o|u|n|t|;| |+@1|i|)| |{| @33
@4|b+0#af5f00255&|r|e|a|k|;+0#0000000&| @64 @11|b+0#af5f00255&|r|e|a|k|;+0#0000000&| @57
@2|}| @71 @8|}| @65
|}| @73 |}| @73
|"|X|t|e|s|t|.|c|"| |1|9|L|,| |3|6|4|C| @37|1|,|1| @10|A|l@1| |"|X|t|e|s|t|.|c|"| |1|9|L|,| |3|6|1|C| @37|1|,|1| @10|A|l@1|

View File

@@ -551,10 +551,10 @@ func Test_syntax_c()
\ '}', \ '}',
\ ' static void', \ ' static void',
\ 'myFunction(const double count, struct nothing, long there) {', \ 'myFunction(const double count, struct nothing, long there) {',
\ ' // 123: nothing to read here', \ "\t// 123: nothing to read here",
\ ' for (int i = 0; i < count; ++i) {', \ "\tfor (int i = 0; i < count; ++i) {",
\ ' break;', \ "\t break;",
\ ' }', \ "\t}",
\ '}', \ '}',
\ ], 'Xtest.c') \ ], 'Xtest.c')

View File

@@ -753,6 +753,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2156,
/**/ /**/
2155, 2155,
/**/ /**/