vim-patch:8.2.4242: put in Visual mode cannot be repeated

Problem:    Put in Visual mode cannot be repeated.
Solution:   Use "P" to put without yanking the deleted text into the unnamed
            register. (Shougo Matsushita, closes vim/vim#9591)
fb55207ed1

Cherry-pick get_y_previous() and set_y_previous() from patch 8.1.1736.
Nvim has removed y_current, so code related to it is N/A.
This commit is contained in:
zeertzjq
2022-02-09 14:21:04 +08:00
parent 07c97fa02d
commit d9cb3fba92
5 changed files with 56 additions and 9 deletions

View File

@@ -1184,8 +1184,32 @@ func Test_visual_undo_deletes_last_line()
exe "normal ggvjfxO"
undo
normal gNU
bwipe!
endfunc
func Test_visual_paste()
new
" v_p overwrites unnamed register.
call setline(1, ['xxxx'])
call setreg('"', 'foo')
call setreg('-', 'bar')
normal 1Gvp
call assert_equal(@", 'x')
call assert_equal(@-, 'x')
if has('clipboard')
" v_P does not overwrite unnamed register.
call setline(1, ['xxxx'])
call setreg('"', 'foo')
call setreg('-', 'bar')
normal 1GvP
call assert_equal(@", 'foo')
call assert_equal(@-, 'x')
endif
bwipe!
endfunc
" vim: shiftwidth=2 sts=2 expandtab