Patch 8.1.2156

8 views
Skip to first unread message

Bram Moolenaar

unread,
Oct 16, 2019, 10:57:43 AM10/16/19
to vim...@googlegroups.com

Patch 8.1.2156
Problem: First character after Tab is not highlighted.
Solution: Remember the syntax attribute for a column.
Files: src/drawline.c, src/testdir/test_syntax.vim,
src/testdir/dumps/Test_syntax_c_01.dump


*** ../vim-8.1.2155/src/drawline.c 2019-10-16 16:31:13.133277343 +0200
--- src/drawline.c 2019-10-16 16:52:45.138333203 +0200
***************
*** 289,294 ****
--- 289,296 ----
#ifdef FEAT_SYN_HL
int vcol_save_attr = 0; // saved attr for 'cursorcolumn'
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 save_did_emsg;
int draw_color_col = FALSE; // highlight colorcolumn
***************
*** 1414,1425 ****
did_emsg = FALSE;

v = (long)(ptr - line);
! can_spell = TRUE;
! syntax_attr = get_syntax_attr((colnr_T)v,
# ifdef FEAT_SPELL
has_spell ? &can_spell :
# endif
NULL, FALSE);

// combine syntax attribute with 'wincolor'
if (syntax_attr != 0 && win_attr != 0)
--- 1416,1435 ----
did_emsg = FALSE;

v = (long)(ptr - line);
! if (v == prev_syntax_col)
! // at same column again
! syntax_attr = prev_syntax_attr;
! else
! {
! can_spell = TRUE;
! syntax_attr = get_syntax_attr((colnr_T)v,
# ifdef FEAT_SPELL
has_spell ? &can_spell :
# endif
NULL, FALSE);
+ prev_syntax_col = v;
+ prev_syntax_attr = syntax_attr;
+ }

// combine syntax attribute with 'wincolor'
if (syntax_attr != 0 && win_attr != 0)
*** ../vim-8.1.2155/src/testdir/test_syntax.vim 2019-08-26 22:38:17.913955335 +0200
--- src/testdir/test_syntax.vim 2019-10-16 16:34:53.536375263 +0200
***************
*** 551,560 ****
\ '}',
\ ' static void',
\ 'myFunction(const double count, struct nothing, long there) {',
! \ ' // 123: nothing to read here',
! \ ' for (int i = 0; i < count; ++i) {',
! \ ' break;',
! \ ' }',
\ '}',
\ ], 'Xtest.c')

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

*** ../vim-8.1.2155/src/testdir/dumps/Test_syntax_c_01.dump 2018-08-24 21:30:24.818557489 +0200
--- src/testdir/dumps/Test_syntax_c_01.dump 2019-10-16 16:53:53.957913687 +0200
***************
*** 12,20 ****
|}| @73
@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
! @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
! @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
! @4|b+0#af5f00255&|r|e|a|k|;+0#0000000&| @64
! @2|}| @71
|}| @73
! |"|X|t|e|s|t|.|c|"| |1|9|L|,| |3|6|4|C| @37|1|,|1| @10|A|l@1|
--- 12,20 ----
|}| @73
@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
! @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
! @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
! @11|b+0#af5f00255&|r|e|a|k|;+0#0000000&| @57
! @8|}| @65
|}| @73
! |"|X|t|e|s|t|.|c|"| |1|9|L|,| |3|6|1|C| @37|1|,|1| @10|A|l@1|
*** ../vim-8.1.2155/src/version.c 2019-10-16 16:31:13.133277343 +0200
--- src/version.c 2019-10-16 16:55:24.785377471 +0200
***************
*** 755,756 ****
--- 755,758 ----
{ /* Add new patch number below this line */
+ /**/
+ 2156,
/**/

--
FROG: How you English say: I one more time, mac, I unclog my nose towards
you, sons of a window-dresser, so, you think you could out-clever us
French fellows with your silly knees-bent creeping about advancing
behaviour. (blows a raspberry) I wave my private parts at your aunties,
you brightly-coloured, mealy-templed, cranberry-smelling, electric
donkey-bottom biters.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages