vim-patch:8.2.0035: saving and restoring called_emsg is clumsy (#19335)

Problem:    Saving and restoring called_emsg is clumsy.
Solution:   Count the number of error messages.
53989554a4
This commit is contained in:
zeertzjq
2022-07-13 04:08:49 +08:00
committed by GitHub
parent b1e0197a14
commit 39d51c833a
10 changed files with 26 additions and 49 deletions

View File

@@ -3136,18 +3136,16 @@ void maketitle(void)
if (*p_titlestring != NUL) {
if (stl_syntax & STL_IN_TITLE) {
int use_sandbox = false;
int save_called_emsg = called_emsg;
const int called_emsg_before = called_emsg;
use_sandbox = was_set_insecurely(curwin, "titlestring", 0);
called_emsg = false;
build_stl_str_hl(curwin, buf, sizeof(buf),
(char *)p_titlestring, use_sandbox,
0, maxlen, NULL, NULL);
title_str = buf;
if (called_emsg) {
if (called_emsg > called_emsg_before) {
set_string_option_direct("titlestring", -1, "", OPT_FREE, SID_ERROR);
}
called_emsg |= save_called_emsg;
} else {
title_str = (char *)p_titlestring;
}
@@ -3252,17 +3250,15 @@ void maketitle(void)
if (*p_iconstring != NUL) {
if (stl_syntax & STL_IN_ICON) {
int use_sandbox = false;
int save_called_emsg = called_emsg;
const int called_emsg_before = called_emsg;
use_sandbox = was_set_insecurely(curwin, "iconstring", 0);
called_emsg = false;
build_stl_str_hl(curwin, icon_str, sizeof(buf),
(char *)p_iconstring, use_sandbox,
0, 0, NULL, NULL);
if (called_emsg) {
if (called_emsg > called_emsg_before) {
set_string_option_direct("iconstring", -1, "", OPT_FREE, SID_ERROR);
}
called_emsg |= save_called_emsg;
} else {
icon_str = (char *)p_iconstring;
}