diff src/evalvars.c @ 21265:6a4806e326dd v8.2.1183

patch 8.2.1183: assert_fails() checks the last error message Commit: https://github.com/vim/vim/commit/9b7bf9e98f06ece595fed7a3ff53ecce89797a53 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 11 22:14:59 2020 +0200 patch 8.2.1183: assert_fails() checks the last error message Problem: assert_fails() checks the last error message. Solution: Check the first error, it is more relevant. Fix all the tests that rely on the old behavior.
author Bram Moolenaar <Bram@vim.org>
date Sat, 11 Jul 2020 22:30:07 +0200
parents caab594592cc
children 7833afe1c66e
line wrap: on
line diff
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -3388,7 +3388,7 @@ static char_u	*redir_varname = NULL;
     int
 var_redir_start(char_u *name, int append)
 {
-    int		save_emsg;
+    int		called_emsg_before;
     int		err;
     typval_T	tv;
 
@@ -3432,8 +3432,7 @@ var_redir_start(char_u *name, int append
 
     // check if we can write to the variable: set it to or append an empty
     // string
-    save_emsg = did_emsg;
-    did_emsg = FALSE;
+    called_emsg_before = called_emsg;
     tv.v_type = VAR_STRING;
     tv.vval.v_string = (char_u *)"";
     if (append)
@@ -3441,9 +3440,7 @@ var_redir_start(char_u *name, int append
     else
 	set_var_lval(redir_lval, redir_endp, &tv, TRUE, 0, (char_u *)"=");
     clear_lval(redir_lval);
-    err = did_emsg;
-    did_emsg |= save_emsg;
-    if (err)
+    if (called_emsg > called_emsg_before)
     {
 	redir_endp = NULL;  // don't store a value, only cleanup
 	var_redir_stop();