0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 9.0.0844: handling 'statusline' errors is spread out

Problem:    Handling 'statusline' errors is spread out.
Solution:   Pass the option name to the lower levels so the option can be
            reset there when an error is encountered. (Luuk van Baal,
            closes #11467)
This commit is contained in:
Luuk van Baal
2022-11-07 12:16:51 +00:00
committed by Bram Moolenaar
parent 1756f4b218
commit 7b224fdf4a
7 changed files with 43 additions and 91 deletions

View File

@@ -573,7 +573,6 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED)
redraw_custom_statusline(win_T *wp)
{
static int entered = FALSE;
int saved_did_emsg = did_emsg;
// When called recursively return. This can happen when the statusline
// contains an expression that triggers a redraw.
@@ -581,18 +580,7 @@ redraw_custom_statusline(win_T *wp)
return;
entered = TRUE;
did_emsg = FALSE;
win_redr_custom(wp, FALSE);
if (did_emsg)
{
// When there is an error disable the statusline, otherwise the
// display is messed up with errors and a redraw triggers the problem
// again and again.
set_string_option_direct((char_u *)"statusline", -1,
(char_u *)"", OPT_FREE | (*wp->w_p_stl != NUL
? OPT_LOCAL : OPT_GLOBAL), SID_ERROR);
}
did_emsg |= saved_did_emsg;
entered = FALSE;
}
#endif
@@ -673,12 +661,7 @@ win_redr_ruler(win_T *wp, int always, int ignore_pum)
#ifdef FEAT_STL_OPT
if (*p_ruf)
{
int called_emsg_before = called_emsg;
win_redr_custom(wp, TRUE);
if (called_emsg > called_emsg_before)
set_string_option_direct((char_u *)"rulerformat", -1,
(char_u *)"", OPT_FREE, SID_ERROR);
return;
}
#endif