Merge pull request #34294 from glepnir/vim-9.1.1426

vim-patch:9.1.{1426,1428}: register completion improve
This commit is contained in:
zeertzjq
2025-06-04 13:46:19 +08:00
committed by GitHub
6 changed files with 85 additions and 26 deletions

View File

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