comparison 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
comparison
equal deleted inserted replaced
18948:bb405ee57349 18949:5c405689da3e
3744 { 3744 {
3745 #ifdef FEAT_STL_OPT 3745 #ifdef FEAT_STL_OPT
3746 if (stl_syntax & STL_IN_TITLE) 3746 if (stl_syntax & STL_IN_TITLE)
3747 { 3747 {
3748 int use_sandbox = FALSE; 3748 int use_sandbox = FALSE;
3749 int save_called_emsg = called_emsg; 3749 int called_emsg_before = called_emsg;
3750 3750
3751 # ifdef FEAT_EVAL 3751 # ifdef FEAT_EVAL
3752 use_sandbox = was_set_insecurely((char_u *)"titlestring", 0); 3752 use_sandbox = was_set_insecurely((char_u *)"titlestring", 0);
3753 # endif 3753 # endif
3754 called_emsg = FALSE;
3755 build_stl_str_hl(curwin, title_str, sizeof(buf), 3754 build_stl_str_hl(curwin, title_str, sizeof(buf),
3756 p_titlestring, use_sandbox, 3755 p_titlestring, use_sandbox,
3757 0, maxlen, NULL, NULL); 3756 0, maxlen, NULL, NULL);
3758 if (called_emsg) 3757 if (called_emsg > called_emsg_before)
3759 set_string_option_direct((char_u *)"titlestring", -1, 3758 set_string_option_direct((char_u *)"titlestring", -1,
3760 (char_u *)"", OPT_FREE, SID_ERROR); 3759 (char_u *)"", OPT_FREE, SID_ERROR);
3761 called_emsg |= save_called_emsg;
3762 } 3760 }
3763 else 3761 else
3764 #endif 3762 #endif
3765 title_str = p_titlestring; 3763 title_str = p_titlestring;
3766 } 3764 }
3877 { 3875 {
3878 #ifdef FEAT_STL_OPT 3876 #ifdef FEAT_STL_OPT
3879 if (stl_syntax & STL_IN_ICON) 3877 if (stl_syntax & STL_IN_ICON)
3880 { 3878 {
3881 int use_sandbox = FALSE; 3879 int use_sandbox = FALSE;
3882 int save_called_emsg = called_emsg; 3880 int called_emsg_before = called_emsg;
3883 3881
3884 # ifdef FEAT_EVAL 3882 # ifdef FEAT_EVAL
3885 use_sandbox = was_set_insecurely((char_u *)"iconstring", 0); 3883 use_sandbox = was_set_insecurely((char_u *)"iconstring", 0);
3886 # endif 3884 # endif
3887 called_emsg = FALSE;
3888 build_stl_str_hl(curwin, icon_str, sizeof(buf), 3885 build_stl_str_hl(curwin, icon_str, sizeof(buf),
3889 p_iconstring, use_sandbox, 3886 p_iconstring, use_sandbox,
3890 0, 0, NULL, NULL); 3887 0, 0, NULL, NULL);
3891 if (called_emsg) 3888 if (called_emsg > called_emsg_before)
3892 set_string_option_direct((char_u *)"iconstring", -1, 3889 set_string_option_direct((char_u *)"iconstring", -1,
3893 (char_u *)"", OPT_FREE, SID_ERROR); 3890 (char_u *)"", OPT_FREE, SID_ERROR);
3894 called_emsg |= save_called_emsg;
3895 } 3891 }
3896 else 3892 else
3897 #endif 3893 #endif
3898 icon_str = p_iconstring; 3894 icon_str = p_iconstring;
3899 } 3895 }