mirror of
https://github.com/vim/vim.git
synced 2025-10-22 08:34:29 -04:00
patch 9.1.1868: v:register is wrong in v_: command
Problem: v:register is wrong in v_: command (after 9.1.1858). Solution: Don't reset v:register for OP_COLON (zeertzjq) related: https://github.com/vim/vim/pull/18583#issuecomment-3418030021 closes: #18597 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
5932ed33f7
commit
0124320c97
17
src/normal.c
17
src/normal.c
@@ -695,6 +695,9 @@ normal_cmd(
|
|||||||
int idx;
|
int idx;
|
||||||
int set_prevcount = FALSE;
|
int set_prevcount = FALSE;
|
||||||
int save_did_cursorhold = did_cursorhold;
|
int save_did_cursorhold = did_cursorhold;
|
||||||
|
#ifdef FEAT_EVAL
|
||||||
|
int did_visual_op = FALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
CLEAR_FIELD(ca); // also resets ca.retval
|
CLEAR_FIELD(ca); // also resets ca.retval
|
||||||
ca.oap = oap;
|
ca.oap = oap;
|
||||||
@@ -968,14 +971,18 @@ normal_cmd(
|
|||||||
if (old_mapped_len > 0)
|
if (old_mapped_len > 0)
|
||||||
old_mapped_len = typebuf_maplen();
|
old_mapped_len = typebuf_maplen();
|
||||||
|
|
||||||
#ifdef FEAT_EVAL
|
|
||||||
int prev_VIsual_active = VIsual_active;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// If an operation is pending, handle it. But not for K_IGNORE or
|
// If an operation is pending, handle it. But not for K_IGNORE or
|
||||||
// K_MOUSEMOVE.
|
// K_MOUSEMOVE.
|
||||||
if (ca.cmdchar != K_IGNORE && ca.cmdchar != K_MOUSEMOVE)
|
if (ca.cmdchar != K_IGNORE && ca.cmdchar != K_MOUSEMOVE)
|
||||||
|
{
|
||||||
|
#ifdef FEAT_EVAL
|
||||||
|
did_visual_op = VIsual_active && oap->op_type != OP_NOP
|
||||||
|
// For OP_COLON, do_pending_operator() stuffs ':' into
|
||||||
|
// the read buffer, which isn't executed immediately.
|
||||||
|
&& oap->op_type != OP_COLON;
|
||||||
|
#endif
|
||||||
do_pending_operator(&ca, old_col, FALSE);
|
do_pending_operator(&ca, old_col, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
// Wait for a moment when a message is displayed that will be overwritten
|
// Wait for a moment when a message is displayed that will be overwritten
|
||||||
// by the mode message.
|
// by the mode message.
|
||||||
@@ -988,7 +995,7 @@ normal_end:
|
|||||||
msg_nowait = FALSE;
|
msg_nowait = FALSE;
|
||||||
|
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (finish_op || prev_VIsual_active)
|
if (finish_op || did_visual_op)
|
||||||
reset_reg_var();
|
reset_reg_var();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -692,7 +692,9 @@ func Test_v_register()
|
|||||||
exec 'normal! "' .. v:register .. 'P'
|
exec 'normal! "' .. v:register .. 'P'
|
||||||
endfunc
|
endfunc
|
||||||
nnoremap <buffer> <plug>(test) :<c-u>call s:Put()<cr>
|
nnoremap <buffer> <plug>(test) :<c-u>call s:Put()<cr>
|
||||||
|
xnoremap <buffer> <plug>(test) :<c-u>call s:Put()<cr>
|
||||||
nmap <buffer> S <plug>(test)
|
nmap <buffer> S <plug>(test)
|
||||||
|
xmap <buffer> S <plug>(test)
|
||||||
|
|
||||||
let @z = "testz\n"
|
let @z = "testz\n"
|
||||||
let @" = "test@\n"
|
let @" = "test@\n"
|
||||||
@@ -710,15 +712,41 @@ func Test_v_register()
|
|||||||
let s:register = ''
|
let s:register = ''
|
||||||
call feedkeys('"zS', 'mx')
|
call feedkeys('"zS', 'mx')
|
||||||
call assert_equal('z', s:register)
|
call assert_equal('z', s:register)
|
||||||
|
call assert_equal('testz', getline('.'))
|
||||||
|
|
||||||
let s:register = ''
|
let s:register = ''
|
||||||
call feedkeys('"zSS', 'mx')
|
call feedkeys('"zSS', 'mx')
|
||||||
call assert_equal('"', s:register)
|
call assert_equal('"', s:register)
|
||||||
|
call assert_equal('test@', getline('.'))
|
||||||
|
|
||||||
|
let s:register = ''
|
||||||
|
call feedkeys("\"z\<Ignore>S", 'mx')
|
||||||
|
call assert_equal('z', s:register)
|
||||||
|
call assert_equal('testz', getline('.'))
|
||||||
|
|
||||||
let s:register = ''
|
let s:register = ''
|
||||||
call feedkeys('"_S', 'mx')
|
call feedkeys('"_S', 'mx')
|
||||||
call assert_equal('_', s:register)
|
call assert_equal('_', s:register)
|
||||||
|
|
||||||
|
let s:register = ''
|
||||||
|
call feedkeys('V"zS', 'mx')
|
||||||
|
call assert_equal('z', s:register)
|
||||||
|
call assert_equal('testz', getline('.'))
|
||||||
|
|
||||||
|
let s:register = ''
|
||||||
|
call feedkeys('V"zSS', 'mx')
|
||||||
|
call assert_equal('"', s:register)
|
||||||
|
call assert_equal('test@', getline('.'))
|
||||||
|
|
||||||
|
let s:register = ''
|
||||||
|
call feedkeys("V\"z\<Ignore>S", 'mx')
|
||||||
|
call assert_equal('z', s:register)
|
||||||
|
call assert_equal('testz', getline('.'))
|
||||||
|
|
||||||
|
let s:register = ''
|
||||||
|
call feedkeys('V"_S', 'mx')
|
||||||
|
call assert_equal('_', s:register)
|
||||||
|
|
||||||
let s:register = ''
|
let s:register = ''
|
||||||
normal "_ddS
|
normal "_ddS
|
||||||
call assert_equal('"', s:register) " fails before 8.2.0929
|
call assert_equal('"', s:register) " fails before 8.2.0929
|
||||||
|
@@ -734,6 +734,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1868,
|
||||||
/**/
|
/**/
|
||||||
1867,
|
1867,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user