diff src/gui.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 23f68e3cb66e
children 7abe2444d1e1
line wrap: on
line diff
--- a/src/gui.c
+++ b/src/gui.c
@@ -3704,14 +3704,12 @@ get_tabline_label(
     if (**opt != NUL)
     {
 	int	use_sandbox = FALSE;
-	int	save_called_emsg = called_emsg;
+	int	called_emsg_before = called_emsg;
 	char_u	res[MAXPATHL];
 	tabpage_T *save_curtab;
 	char_u	*opt_name = (char_u *)(tooltip ? "guitabtooltip"
 							     : "guitablabel");
 
-	called_emsg = FALSE;
-
 	printer_page_num = tabpage_index(tp);
 # ifdef FEAT_EVAL
 	set_vim_var_nr(VV_LNUM, printer_page_num);
@@ -3742,10 +3740,9 @@ get_tabline_label(
 	curwin = curtab->tp_curwin;
 	curbuf = curwin->w_buffer;
 
-	if (called_emsg)
+	if (called_emsg > called_emsg_before)
 	    set_string_option_direct(opt_name, -1,
 					   (char_u *)"", OPT_FREE, SID_ERROR);
-	called_emsg |= save_called_emsg;
     }
 
     // If 'guitablabel'/'guitabtooltip' is not set or the result is empty then