vim-patch:8.2.3475: expression register set by not executed put command (#17211)

This commit is contained in:
zeertzjq 2022-01-31 08:11:26 +08:00 committed by GitHub
parent a28a9aec63
commit 58d01d3403
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -1758,7 +1758,9 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe
ea.regname = *ea.arg++;
// 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));
if (!ea.skip) {
set_expr_line(vim_strsave(ea.arg));
}
ea.arg += STRLEN(ea.arg);
}
ea.arg = skipwhite(ea.arg);

View File

@ -400,3 +400,13 @@ func Test_winsize_cmd()
call assert_fails('win_getid(1)', 'E475: Invalid argument: _getid(1)')
" Actually changing the window size would be flaky.
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