diff options
author | kuuote <znmxodq1@gmail.com> | 2021-10-04 22:17:36 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-10-04 22:17:36 +0100 |
commit | 08d7b1c82866a61b61a55e55b6c190dba04e54ea (patch) | |
tree | d611343ead8155cda84d941ee25c6e6127814915 /src | |
parent | 965d2edbce1a8ccba96925be5ac4575981f68949 (diff) |
patch 8.2.3475: expression register set by not executed put commandv8.2.3475
Problem: Expression register set by not executed put command.
Solution: Do not set the register if the command is skipped. (closes #8909)
Diffstat (limited to 'src')
-rw-r--r-- | src/ex_docmd.c | 7 | ||||
-rw-r--r-- | src/testdir/test_excmd.vim | 8 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 15 insertions, 2 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 617de6f06d..2c55e67bc3 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -2382,9 +2382,12 @@ do_one_cmd( // for '=' register: accept the rest of the line as an expression if (ea.arg[-1] == '=' && ea.arg[0] != NUL) { - set_expr_line(vim_strsave(ea.arg), &ea); + if (!ea.skip) + { + set_expr_line(vim_strsave(ea.arg), &ea); + did_set_expr_line = TRUE; + } ea.arg += STRLEN(ea.arg); - did_set_expr_line = TRUE; } #endif ea.arg = skipwhite(ea.arg); diff --git a/src/testdir/test_excmd.vim b/src/testdir/test_excmd.vim index b080575e40..c3a911f6cb 100644 --- a/src/testdir/test_excmd.vim +++ b/src/testdir/test_excmd.vim @@ -647,4 +647,12 @@ func Test_command_not_implemented_E319() endif endfunc +func Test_not_break_expression_register() + call setreg('=', '1+1') + if 0 + put =1 + endif + call assert_equal('1+1', getreg('=', 1)) +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index e92719172f..e6a4b1ad5d 100644 --- a/src/version.c +++ b/src/version.c @@ -758,6 +758,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3475, +/**/ 3474, /**/ 3473, |