diff src/buffer.c @ 18949:5c405689da3e v8.2.0035

patch 8.2.0035: saving and restoring called_emsg is clumsy Commit: https://github.com/vim/vim/commit/53989554a44caca0964376d60297f08ec257c53c Author: Bram Moolenaar <Bram@vim.org> Date: Mon Dec 23 22:59:18 2019 +0100 patch 8.2.0035: saving and restoring called_emsg is clumsy Problem: Saving and restoring called_emsg is clumsy. Solution: Count the number of error messages.
author Bram Moolenaar <Bram@vim.org>
date Mon, 23 Dec 2019 23:00:03 +0100
parents 050f5eaa9e50
children e378907d79bf
line wrap: on
line diff
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -3746,19 +3746,17 @@ maketitle(void)
 	    if (stl_syntax & STL_IN_TITLE)
 	    {
 		int	use_sandbox = FALSE;
-		int	save_called_emsg = called_emsg;
+		int	called_emsg_before = called_emsg;
 
 # ifdef FEAT_EVAL
 		use_sandbox = was_set_insecurely((char_u *)"titlestring", 0);
 # endif
-		called_emsg = FALSE;
 		build_stl_str_hl(curwin, title_str, sizeof(buf),
 					      p_titlestring, use_sandbox,
 					      0, maxlen, NULL, NULL);
-		if (called_emsg)
+		if (called_emsg > called_emsg_before)
 		    set_string_option_direct((char_u *)"titlestring", -1,
 					   (char_u *)"", OPT_FREE, SID_ERROR);
-		called_emsg |= save_called_emsg;
 	    }
 	    else
 #endif
@@ -3879,19 +3877,17 @@ maketitle(void)
 	    if (stl_syntax & STL_IN_ICON)
 	    {
 		int	use_sandbox = FALSE;
-		int	save_called_emsg = called_emsg;
+		int	called_emsg_before = called_emsg;
 
 # ifdef FEAT_EVAL
 		use_sandbox = was_set_insecurely((char_u *)"iconstring", 0);
 # endif
-		called_emsg = FALSE;
 		build_stl_str_hl(curwin, icon_str, sizeof(buf),
 						    p_iconstring, use_sandbox,
 						    0, 0, NULL, NULL);
-		if (called_emsg)
+		if (called_emsg > called_emsg_before)
 		    set_string_option_direct((char_u *)"iconstring", -1,
 					   (char_u *)"", OPT_FREE, SID_ERROR);
-		called_emsg |= save_called_emsg;
 	    }
 	    else
 #endif