diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-09-22 13:44:56 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-09-22 13:44:56 +0200 |
commit | f3d769a585040ac47f7054057758809024ef6377 (patch) | |
tree | 24e3a84b889a8f9c1c9a1868988fea9f2e77be5a /src/syntax.c | |
parent | 8b21de33bb288738c1445bc7241d3d5106124d66 (diff) | |
download | vim-git-f3d769a585040ac47f7054057758809024ef6377.tar.gz |
patch 8.0.1133: syntax timeout not used correctlyv8.0.1133
Problem: Syntax timeout not used correctly.
Solution: Do not pass the timeout to syntax_start() but set it explicitly.
(Yasuhiro Matsumoto, closes #2139)
Diffstat (limited to 'src/syntax.c')
-rw-r--r-- | src/syntax.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/syntax.c b/src/syntax.c index 6361bd7aa..d9a7b4fd8 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -368,7 +368,7 @@ static win_T *syn_win; /* current window for highlighting */ static buf_T *syn_buf; /* current buffer for highlighting */ static synblock_T *syn_block; /* current buffer for highlighting */ #ifdef FEAT_RELTIME -static proftime_T *syn_tm; +static proftime_T *syn_tm; /* timeout limit */ #endif static linenr_T current_lnum = 0; /* lnum of current state */ static colnr_T current_col = 0; /* column of current state */ @@ -489,6 +489,18 @@ static int get_id_list(char_u **arg, int keylen, short **list, int skip); static void syn_combine_list(short **clstr1, short **clstr2, int list_op); static void syn_incl_toplevel(int id, int *flagsp); +#if defined(FEAT_RELTIME) || defined(PROTO) +/* + * Set the timeout used for syntax highlighting. + * Use NULL to reset, no timeout. + */ + void +syn_set_timeout(proftime_T *tm) +{ + syn_tm = tm; +} +#endif + /* * Start the syntax recognition for a line. This function is normally called * from the screen updating, once for each displayed line. @@ -497,7 +509,7 @@ static void syn_incl_toplevel(int id, int *flagsp); * window. */ void -syntax_start(win_T *wp, linenr_T lnum, proftime_T *syntax_tm UNUSED) +syntax_start(win_T *wp, linenr_T lnum) { synstate_T *p; synstate_T *last_valid = NULL; @@ -527,9 +539,6 @@ syntax_start(win_T *wp, linenr_T lnum, proftime_T *syntax_tm UNUSED) } changedtick = CHANGEDTICK(syn_buf); syn_win = wp; -#ifdef FEAT_RELTIME - syn_tm = syntax_tm; -#endif /* * Allocate syntax stack when needed. @@ -6569,7 +6578,7 @@ syn_get_id( if (wp->w_buffer != syn_buf || lnum != current_lnum || col < current_col) - syntax_start(wp, lnum, NULL); + syntax_start(wp, lnum); else if (wp->w_buffer == syn_buf && lnum == current_lnum && col > current_col) @@ -6645,7 +6654,7 @@ syn_get_foldlevel(win_T *wp, long lnum) # endif ) { - syntax_start(wp, lnum, NULL); + syntax_start(wp, lnum); for (i = 0; i < current_state.ga_len; ++i) if (CUR_STATE(i).si_flags & HL_FOLD) @@ -7006,7 +7015,7 @@ static char *(highlight_init_light[]) = { CENT("ToolbarLine term=underline ctermbg=LightGrey", "ToolbarLine term=underline ctermbg=LightGrey guibg=LightGrey"), CENT("ToolbarButton cterm=bold ctermfg=White ctermbg=DarkGrey", - "ToolbarButton cterm=bold ctermfg=White ctermbg=DarkGrey gui=bold guifg=White guibg=DarkGrey"), + "ToolbarButton cterm=bold ctermfg=White ctermbg=DarkGrey gui=bold guifg=White guibg=Grey40"), #endif NULL }; @@ -7102,7 +7111,7 @@ static char *(highlight_init_dark[]) = { #endif #ifdef FEAT_MENU CENT("ToolbarLine term=underline ctermbg=DarkGrey", - "ToolbarLine term=underline ctermbg=DarkGrey guibg=DarkGrey"), + "ToolbarLine term=underline ctermbg=DarkGrey guibg=Grey50"), CENT("ToolbarButton cterm=bold ctermfg=Black ctermbg=LightGrey", "ToolbarButton cterm=bold ctermfg=Black ctermbg=LightGrey gui=bold guifg=Black guibg=LightGrey"), #endif |