1
0
forked from aniani/vim

patch 8.2.3475: expression register set by not executed put command

Problem:    Expression register set by not executed put command.
Solution:   Do not set the register if the command is skipped. (closes #8909)
This commit is contained in:
kuuote 2021-10-04 22:17:36 +01:00 committed by Bram Moolenaar
parent 965d2edbce
commit 08d7b1c828
3 changed files with 15 additions and 2 deletions

View File

@ -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);

View File

@ -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

View File

@ -757,6 +757,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
3475,
/**/
3474,
/**/