diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-07-11 22:14:59 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-07-11 22:14:59 +0200 |
commit | 9b7bf9e98f06ece595fed7a3ff53ecce89797a53 (patch) | |
tree | 4a9b2cd5ac2f18f3c2c017530ab95f6878f1e757 /src/evalvars.c | |
parent | 914e7eaa67f8d816e15fb4a1180e6bece88d9742 (diff) |
patch 8.2.1183: assert_fails() checks the last error messagev8.2.1183
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.
Diffstat (limited to 'src/evalvars.c')
-rw-r--r-- | src/evalvars.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/evalvars.c b/src/evalvars.c index 9cd2ec2c89..70660397c7 100644 --- 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(); |