Problem: Mechanism to prevent recursive screen updating is incomplete.
Solution: Add "redraw_not_allowed" and set it in build_stl_str_hl().
(issue #10952)
char_u win_tmp[TMPLEN];
char_u *usefmt = fmt;
stl_hlrec_T *sp;
- int save_must_redraw = must_redraw;
- int save_redr_type = curwin->w_redr_type;
+ int save_redraw_not_allowed = redraw_not_allowed;
int save_KeyTyped = KeyTyped;
+ // When inside update_screen() we do not want redrawing a statusline,
+ // ruler, title, etc. to trigger another redraw, it may cause an endless
+ // loop.
+ if (updating_screen)
+ redraw_not_allowed = TRUE;
+
if (stl_items == NULL)
{
stl_items = ALLOC_MULT(stl_item_T, stl_items_len);
else
stl_items[curitem].stl_type = Empty;
+ if (num >= 0 || (!itemisflag && str != NULL && *str != NUL))
+ prevchar_isflag = FALSE; // Item not NULL, but not a flag
+ //
if (opt == STL_VIM_EXPR)
vim_free(str);
-
- if (num >= 0 || (!itemisflag && str && *str))
- prevchar_isflag = FALSE; // Item not NULL, but not a flag
curitem++;
}
*p = NUL;
sp->userhl = 0;
}
- // When inside update_screen we do not want redrawing a statusline, ruler,
- // title, etc. to trigger another redraw, it may cause an endless loop.
- if (updating_screen)
- {
- must_redraw = save_must_redraw;
- curwin->w_redr_type = save_redr_type;
- }
+ redraw_not_allowed = save_redraw_not_allowed;
// A user function may reset KeyTyped, restore it.
KeyTyped = save_KeyTyped;
linenr_T last = lnume + xtra - 1; // last line after the change
#endif
// Mark this window to be redrawn later.
- if (wp->w_redr_type < UPD_VALID)
+ if (!redraw_not_allowed && wp->w_redr_type < UPD_VALID)
wp->w_redr_type = UPD_VALID;
// Check if a change in the buffer has invalidated the cached
// Call update_screen() later, which checks out what needs to be redrawn,
// since it notices b_mod_set and then uses b_mod_*.
- if (must_redraw < UPD_VALID)
- must_redraw = UPD_VALID;
+ set_must_redraw(UPD_VALID);
// when the cursor line is changed always trigger CursorMoved
if (lnum <= curwin->w_cursor.lnum
// clear screen, because some digraphs may be wrong, in which case we
// messed up ScreenLines
- must_redraw = UPD_CLEAR;
+ set_must_redraw(UPD_CLEAR);
}
static void
win_T *wp,
int type)
{
- if (!exiting && wp->w_redr_type < type)
+ if (!exiting && !redraw_not_allowed && wp->w_redr_type < type)
{
wp->w_redr_type = type;
if (type >= UPD_NOT_VALID)
FOR_ALL_WINDOWS(wp)
redraw_win_later(wp, type);
// This may be needed when switching tabs.
- if (must_redraw < type)
+ set_must_redraw(type);
+}
+
+/*
+ * Set "must_redraw" to "type" unless it already has a higher value
+ * or it is currently not allowed.
+ */
+ void
+set_must_redraw(int type)
+{
+ if (!redraw_not_allowed && must_redraw < type)
must_redraw = type;
}
#ifdef FEAT_GUI
hold_gui_events = 0;
#endif
- must_redraw = UPD_CLEAR;
+ set_must_redraw(UPD_CLEAR);
pending_exmode_active = TRUE;
main_loop(FALSE, TRUE);
#endif
// While redrawing the screen this flag is set. It means the screen size
-// ('lines' and 'rows') must not be changed.
+// ('lines' and 'rows') must not be changed and prevents recursive updating.
EXTERN int updating_screen INIT(= FALSE);
+// While computing a statusline and the like we do not want any w_redr_type or
+// must_redraw to be set.
+EXTERN int redraw_not_allowed INIT(= FALSE);
+
#ifdef MESSAGE_QUEUE
// While closing windows or buffers messages should not be handled to avoid
// using invalid windows or buffers.
if (!gui.in_use && !gui.starting)
#endif
{
- must_redraw = UPD_CLEAR;
+ set_must_redraw(UPD_CLEAR);
if (termcap_active && color >= 0)
term_fg_color(color);
}
if (!gui.in_use && !gui.starting)
#endif
{
- must_redraw = UPD_CLEAR;
+ set_must_redraw(UPD_CLEAR);
if (color >= 0)
{
int dark = -1;
if (!gui.in_use && !gui.starting)
#endif
{
- must_redraw = UPD_CLEAR;
+ set_must_redraw(UPD_CLEAR);
if (termcap_active && color >= 0)
term_ul_color(color);
}
FALSE, TRUE, FALSE))
{
gui_mch_new_colors();
- must_redraw = UPD_CLEAR;
+ set_must_redraw(UPD_CLEAR);
}
# ifdef FEAT_GUI_X11
if (set_group_colors((char_u *)"Menu",
# ifdef FEAT_MENU
gui_mch_new_menu_colors();
# endif
- must_redraw = UPD_CLEAR;
+ set_must_redraw(UPD_CLEAR);
}
# ifdef FEAT_BEVAL_GUI
if (set_group_colors((char_u *)"Tooltip",
# ifdef FEAT_TOOLBAR
gui_mch_new_tooltip_colors();
# endif
- must_redraw = UPD_CLEAR;
+ set_must_redraw(UPD_CLEAR);
}
# endif
if (set_group_colors((char_u *)"Scrollbar",
FALSE, FALSE, FALSE))
{
gui_new_scrollbar_colors();
- must_redraw = UPD_CLEAR;
+ set_must_redraw(UPD_CLEAR);
}
# endif
}
// color
cterm_normal_fg_gui_color = HL_TABLE()[idx].sg_gui_fg;
cterm_normal_bg_gui_color = HL_TABLE()[idx].sg_gui_bg;
- must_redraw = UPD_CLEAR;
+ set_must_redraw(UPD_CLEAR);
}
}
}
clear_hl_tables();
- must_redraw = UPD_CLEAR;
+ set_must_redraw(UPD_CLEAR);
for (i = 0; i < highlight_ga.ga_len; ++i)
set_hl_attr(i);
&& !gui.in_use
#endif
)
- must_redraw = UPD_CLEAR;
+ set_must_redraw(UPD_CLEAR);
else
{
screenclear(); // clear screen
FILE *save_scriptout;
if (redraw == TRUE)
- must_redraw = UPD_CLEAR;
+ set_must_redraw(UPD_CLEAR);
// If using ":silent cmd", don't wait for a return. Also don't set
// need_wait_return to do it later.
}
#endif
++msg_scrolled;
- if (must_redraw < UPD_VALID)
- must_redraw = UPD_VALID;
+ set_must_redraw(UPD_VALID);
}
/*
clear_chartabsize_arg(&cts);
col = (int)cts.cts_vcol;
- /*
- * If list mode is on, then the '$' at the end of the line may take up one
- * extra column.
- */
+ // If list mode is on, then the '$' at the end of the line may take up one
+ // extra column.
if (wp->w_p_list && wp->w_lcs_chars.eol != NUL)
col += 1;
if (wp->w_buffer == buf && wp->w_status_height)
{
wp->w_redr_status = TRUE;
- if (must_redraw < UPD_VALID)
- must_redraw = UPD_VALID;
+ set_must_redraw(UPD_VALID);
}
}
void redraw_win_later(win_T *wp, int type);
void redraw_later_clear(void);
void redraw_all_later(int type);
+void set_must_redraw(int type);
void redraw_curbuf_later(int type);
void redraw_buf_later(buf_T *buf, int type);
void redraw_buf_line_later(buf_T *buf, linenr_T lnum);
screen_Rows = Rows;
screen_Columns = Columns;
- must_redraw = UPD_CLEAR; // need to clear the screen later
+ set_must_redraw(UPD_CLEAR); // need to clear the screen later
if (doclear)
screenclear2();
#ifdef FEAT_GUI
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 245,
/**/
244,
/**/