mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
vim-patch:9.1.1426: completion: register contents not completed
Problem: CTRL-X CTRL-R only completes individual words from registers,
making it difficult to insert complete register content.
Solution: Add consecutive CTRL-X CTRL-R support - first press completes
words, second press completes full register lines, similar to
CTRL-X CTRL-L and CTRL-X CTRL-P behavior (glepnir).
closes: vim/vim#17395
d5fdfa5c9c
Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
@ -4751,6 +4751,27 @@ func Test_register_completion()
|
||||
call feedkeys("Sze\<C-X>\<C-R>\<C-R>=string(complete_info(['mode']))\<CR>\<ESC>", "tx")
|
||||
call assert_equal("zero{'mode': 'register'}", getline(1))
|
||||
|
||||
" Test consecutive CTRL-X CTRL-R (adding mode)Add commentMore actions
|
||||
" First CTRL-X CTRL-R should split into words, second should use full content
|
||||
let @f = "hello world test complete"
|
||||
call setline(1, "hel")
|
||||
call cursor(1, 3)
|
||||
call feedkeys("a\<C-X>\<C-R>\<C-N>\<Esc>", 'tx')
|
||||
call assert_equal("hello", getline(1))
|
||||
|
||||
" Second consecutive CTRL-X CTRL-R should complete with full content
|
||||
call setline(1, "hello")
|
||||
call cursor(1, 5)
|
||||
call feedkeys("a\<C-X>\<C-R>\<C-X>\<C-R>\<Esc>", 'tx')
|
||||
call assert_equal("hello world test complete", getline(1))
|
||||
|
||||
" Test consecutive completion with multi-line register
|
||||
let @g = "first line content\nsecond line here\nthird line data"
|
||||
call setline(1, "first")
|
||||
call cursor(1, 5)
|
||||
call feedkeys("a\<C-X>\<C-R>\<C-X>\<C-R>\<Esc>", 'tx')
|
||||
call assert_equal("first line content", getline(1))
|
||||
|
||||
" Clean up
|
||||
bwipe!
|
||||
delfunc GetItems
|
||||
|
Reference in New Issue
Block a user