mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.0.1133: syntax timeout not used correctly
Problem: Syntax timeout not used correctly.
Solution: Do not pass the timeout to syntax_start() but set it explicitly.
(Yasuhiro Matsumoto, closes vim/vim#2139)
f3d769a585
This commit is contained in:
parent
b8128aee02
commit
6dacfe7217
@ -1137,6 +1137,7 @@ static void win_update(win_T *wp)
|
||||
got_int = 0;
|
||||
// Set the time limit to 'redrawtime'.
|
||||
proftime_T syntax_tm = profile_setlimit(p_rdt);
|
||||
syn_set_timeout(&syntax_tm);
|
||||
win_foldinfo.fi_level = 0;
|
||||
|
||||
/*
|
||||
@ -1364,8 +1365,7 @@ static void win_update(win_T *wp)
|
||||
/*
|
||||
* Display one line.
|
||||
*/
|
||||
row = win_line(wp, lnum, srow, wp->w_grid.Rows, mod_top == 0, false,
|
||||
&syntax_tm);
|
||||
row = win_line(wp, lnum, srow, wp->w_grid.Rows, mod_top == 0, false);
|
||||
|
||||
wp->w_lines[idx].wl_folded = FALSE;
|
||||
wp->w_lines[idx].wl_lastlnum = lnum;
|
||||
@ -1396,8 +1396,7 @@ static void win_update(win_T *wp)
|
||||
if (fold_count != 0) {
|
||||
fold_line(wp, fold_count, &win_foldinfo, lnum, row);
|
||||
} else {
|
||||
(void)win_line(wp, lnum, srow, wp->w_grid.Rows, true, true,
|
||||
&syntax_tm);
|
||||
(void)win_line(wp, lnum, srow, wp->w_grid.Rows, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1497,6 +1496,7 @@ static void win_update(win_T *wp)
|
||||
if (wp->w_redr_type >= REDRAW_TOP) {
|
||||
draw_vsep_win(wp, 0);
|
||||
}
|
||||
syn_set_timeout(NULL);
|
||||
|
||||
/* Reset the type of redrawing required, the window has been updated. */
|
||||
wp->w_redr_type = 0;
|
||||
@ -2045,8 +2045,7 @@ win_line (
|
||||
int startrow,
|
||||
int endrow,
|
||||
bool nochange, // not updating for changed text
|
||||
bool number_only, // only update the number column
|
||||
proftime_T *syntax_tm
|
||||
bool number_only // only update the number column
|
||||
)
|
||||
{
|
||||
int c = 0; // init for GCC
|
||||
@ -2199,7 +2198,7 @@ win_line (
|
||||
// error, stop syntax highlighting.
|
||||
save_did_emsg = did_emsg;
|
||||
did_emsg = false;
|
||||
syntax_start(wp, lnum, syntax_tm);
|
||||
syntax_start(wp, lnum);
|
||||
if (did_emsg) {
|
||||
wp->w_s->b_syn_error = true;
|
||||
} else {
|
||||
@ -2548,7 +2547,7 @@ win_line (
|
||||
|
||||
// Need to restart syntax highlighting for this line.
|
||||
if (has_syntax) {
|
||||
syntax_start(wp, lnum, syntax_tm);
|
||||
syntax_start(wp, lnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -359,7 +359,7 @@ static reg_extmatch_T *next_match_extmatch = NULL;
|
||||
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
|
||||
static proftime_T *syn_tm;
|
||||
static proftime_T *syn_tm; // timeout limit
|
||||
static linenr_T current_lnum = 0; // lnum of current state
|
||||
static colnr_T current_col = 0; // column of current state
|
||||
static int current_state_stored = 0; // TRUE if stored current state
|
||||
@ -376,7 +376,12 @@ static int current_line_id = 0; // unique number for current line
|
||||
static int syn_time_on = FALSE;
|
||||
# define IF_SYN_TIME(p) (p)
|
||||
|
||||
|
||||
// Set the timeout used for syntax highlighting.
|
||||
// Use NULL to reset, no timeout.
|
||||
void syn_set_timeout(proftime_T *tm)
|
||||
{
|
||||
syn_tm = tm;
|
||||
}
|
||||
|
||||
/*
|
||||
* Start the syntax recognition for a line. This function is normally called
|
||||
@ -385,7 +390,7 @@ static int syn_time_on = FALSE;
|
||||
* it. Careful: curbuf and curwin are likely to point to another buffer and
|
||||
* window.
|
||||
*/
|
||||
void syntax_start(win_T *wp, linenr_T lnum, proftime_T *syntax_tm)
|
||||
void syntax_start(win_T *wp, linenr_T lnum)
|
||||
{
|
||||
synstate_T *p;
|
||||
synstate_T *last_valid = NULL;
|
||||
@ -412,7 +417,6 @@ void syntax_start(win_T *wp, linenr_T lnum, proftime_T *syntax_tm)
|
||||
}
|
||||
changedtick = buf_get_changedtick(syn_buf);
|
||||
syn_win = wp;
|
||||
syn_tm = syntax_tm;
|
||||
|
||||
/*
|
||||
* Allocate syntax stack when needed.
|
||||
@ -5690,7 +5694,7 @@ int syn_get_id(
|
||||
// When the position is not after the current position and in the same
|
||||
// line of the same buffer, need to restart parsing.
|
||||
if (wp->w_buffer != syn_buf || lnum != current_lnum || col < current_col) {
|
||||
syntax_start(wp, lnum, NULL);
|
||||
syntax_start(wp, lnum);
|
||||
} else if (col > current_col) {
|
||||
// next_match may not be correct when moving around, e.g. with the
|
||||
// "skip" expression in searchpair()
|
||||
@ -5768,7 +5772,7 @@ int syn_get_foldlevel(win_T *wp, long lnum)
|
||||
if (wp->w_s->b_syn_folditems != 0
|
||||
&& !wp->w_s->b_syn_error
|
||||
&& !wp->w_s->b_syn_slow) {
|
||||
syntax_start(wp, lnum, NULL);
|
||||
syntax_start(wp, lnum);
|
||||
|
||||
for (int i = 0; i < current_state.ga_len; ++i) {
|
||||
if (CUR_STATE(i).si_flags & HL_FOLD) {
|
||||
|
Loading…
Reference in New Issue
Block a user