mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.0.1073: may get an endless loop if 'statusline' changes a highlight
Problem: May get an endless loop if 'statusline' changes a highlight. Solution: Do not let evaluating 'statusline' trigger a redraw.
This commit is contained in:
22
src/buffer.c
22
src/buffer.c
@@ -3915,8 +3915,8 @@ build_stl_str_hl(
|
|||||||
char_u *t;
|
char_u *t;
|
||||||
int byteval;
|
int byteval;
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
win_T *o_curwin;
|
win_T *save_curwin;
|
||||||
buf_T *o_curbuf;
|
buf_T *save_curbuf;
|
||||||
#endif
|
#endif
|
||||||
int empty_line;
|
int empty_line;
|
||||||
colnr_T virtcol;
|
colnr_T virtcol;
|
||||||
@@ -3958,6 +3958,9 @@ build_stl_str_hl(
|
|||||||
char_u tmp[TMPLEN];
|
char_u tmp[TMPLEN];
|
||||||
char_u *usefmt = fmt;
|
char_u *usefmt = fmt;
|
||||||
struct stl_hlrec *sp;
|
struct stl_hlrec *sp;
|
||||||
|
int save_must_redraw = must_redraw;
|
||||||
|
int save_redr_type = curwin->w_redr_type;
|
||||||
|
int save_highlight_shcnaged = need_highlight_changed;
|
||||||
|
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
/*
|
/*
|
||||||
@@ -4267,15 +4270,15 @@ build_stl_str_hl(
|
|||||||
vim_snprintf((char *)tmp, sizeof(tmp), "%d", curbuf->b_fnum);
|
vim_snprintf((char *)tmp, sizeof(tmp), "%d", curbuf->b_fnum);
|
||||||
set_internal_string_var((char_u *)"actual_curbuf", tmp);
|
set_internal_string_var((char_u *)"actual_curbuf", tmp);
|
||||||
|
|
||||||
o_curbuf = curbuf;
|
save_curbuf = curbuf;
|
||||||
o_curwin = curwin;
|
save_curwin = curwin;
|
||||||
curwin = wp;
|
curwin = wp;
|
||||||
curbuf = wp->w_buffer;
|
curbuf = wp->w_buffer;
|
||||||
|
|
||||||
str = eval_to_string_safe(p, &t, use_sandbox);
|
str = eval_to_string_safe(p, &t, use_sandbox);
|
||||||
|
|
||||||
curwin = o_curwin;
|
curwin = save_curwin;
|
||||||
curbuf = o_curbuf;
|
curbuf = save_curbuf;
|
||||||
do_unlet((char_u *)"g:actual_curbuf", TRUE);
|
do_unlet((char_u *)"g:actual_curbuf", TRUE);
|
||||||
|
|
||||||
if (str != NULL && *str != 0)
|
if (str != NULL && *str != 0)
|
||||||
@@ -4730,6 +4733,13 @@ build_stl_str_hl(
|
|||||||
sp->userhl = 0;
|
sp->userhl = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We do not want redrawing a stausline, ruler, title, etc. to trigger
|
||||||
|
* another redraw, it may cause an endless loop. This happens when a
|
||||||
|
* statusline changes a highlight group. */
|
||||||
|
must_redraw = save_must_redraw;
|
||||||
|
curwin->w_redr_type = save_redr_type;
|
||||||
|
need_highlight_changed = save_highlight_shcnaged;
|
||||||
|
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
#endif /* FEAT_STL_OPT */
|
#endif /* FEAT_STL_OPT */
|
||||||
|
@@ -769,6 +769,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 */
|
||||||
|
/**/
|
||||||
|
1073,
|
||||||
/**/
|
/**/
|
||||||
1072,
|
1072,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user