mirror of
https://github.com/neovim/neovim.git
synced 2026-08-25 08:31:51 +00:00
Merge pull request #15364 from seandewar/vim-8.2.3337
vim-patch:8.2.{3286,3289,3293,3298,3313,3321,3328,3330,3331,3337,3354,3355,3357,3360,3369,3375}
This commit is contained in:
@@ -599,13 +599,26 @@ endfunc
|
||||
|
||||
func Test_cmdline_complete_user_func()
|
||||
call feedkeys(":func Test_cmdline_complete_user\<Tab>\<Home>\"\<cr>", 'tx')
|
||||
call assert_match('"func Test_cmdline_complete_user', @:)
|
||||
call assert_match('"func Test_cmdline_complete_user_', @:)
|
||||
call feedkeys(":func s:ScriptL\<Tab>\<Home>\"\<cr>", 'tx')
|
||||
call assert_match('"func <SNR>\d\+_ScriptLocalFunction', @:)
|
||||
|
||||
" g: prefix also works
|
||||
call feedkeys(":echo g:Test_cmdline_complete_user_f\<Tab>\<Home>\"\<cr>", 'tx')
|
||||
call assert_match('"echo g:Test_cmdline_complete_user_func', @:)
|
||||
|
||||
" using g: prefix does not result in just "g:" matches from a lambda
|
||||
let Fx = { a -> a }
|
||||
call feedkeys(":echo g:\<Tab>\<Home>\"\<cr>", 'tx')
|
||||
call assert_match('"echo g:[A-Z]', @:)
|
||||
|
||||
" existence of script-local dict function does not break user function name
|
||||
" completion
|
||||
function s:a_dict_func() dict
|
||||
endfunction
|
||||
call feedkeys(":call Test_cmdline_complete_user\<Tab>\<Home>\"\<cr>", 'tx')
|
||||
call assert_match('"call Test_cmdline_complete_user_', @:)
|
||||
delfunction s:a_dict_func
|
||||
endfunc
|
||||
|
||||
func Test_cmdline_complete_user_names()
|
||||
|
||||
@@ -313,6 +313,42 @@ func Test_confirm_write_ro()
|
||||
call delete('Xconfirm_write_ro')
|
||||
endfunc
|
||||
|
||||
func Test_confirm_write_partial_file()
|
||||
CheckNotGui
|
||||
CheckRunVimInTerminal
|
||||
|
||||
call writefile(['a', 'b', 'c', 'd'], 'Xwrite_partial')
|
||||
call writefile(['set nobackup ff=unix cmdheight=2',
|
||||
\ 'edit Xwrite_partial'], 'Xscript')
|
||||
let buf = RunVimInTerminal('-S Xscript', {'rows': 20})
|
||||
|
||||
call term_sendkeys(buf, ":confirm 2,3w\n")
|
||||
call WaitForAssert({-> assert_match('^Write partial file? *$',
|
||||
\ term_getline(buf, 19))}, 1000)
|
||||
call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$',
|
||||
\ term_getline(buf, 20))}, 1000)
|
||||
call term_sendkeys(buf, 'N')
|
||||
call WaitForAssert({-> assert_match('.* All$', term_getline(buf, 20))}, 1000)
|
||||
call assert_equal(['a', 'b', 'c', 'd'], readfile('Xwrite_partial'))
|
||||
call delete('Xwrite_partial')
|
||||
|
||||
call term_sendkeys(buf, ":confirm 2,3w\n")
|
||||
call WaitForAssert({-> assert_match('^Write partial file? *$',
|
||||
\ term_getline(buf, 19))}, 1000)
|
||||
call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$',
|
||||
\ term_getline(buf, 20))}, 1000)
|
||||
call term_sendkeys(buf, 'Y')
|
||||
call WaitForAssert({-> assert_match('^"Xwrite_partial" \[New\] 2L, 4B written *$',
|
||||
\ term_getline(buf, 19))}, 1000)
|
||||
call WaitForAssert({-> assert_match('^Press ENTER or type command to continue *$',
|
||||
\ term_getline(buf, 20))}, 1000)
|
||||
call assert_equal(['b', 'c'], readfile('Xwrite_partial'))
|
||||
|
||||
call StopVimInTerminal(buf)
|
||||
call delete('Xwrite_partial')
|
||||
call delete('Xscript')
|
||||
endfunc
|
||||
|
||||
" Test for the :winsize command
|
||||
func Test_winsize_cmd()
|
||||
call assert_fails('winsize 1', 'E465:')
|
||||
|
||||
51
src/nvim/testdir/test_ins_complete_no_halt.vim
Normal file
51
src/nvim/testdir/test_ins_complete_no_halt.vim
Normal file
@@ -0,0 +1,51 @@
|
||||
" Test insert mode completion does not get stuck when looping around.
|
||||
" In a separate file to avoid the settings to leak to other test cases.
|
||||
|
||||
set complete+=kspell
|
||||
set completeopt+=menu
|
||||
set completeopt+=menuone
|
||||
set completeopt+=noselect
|
||||
set completeopt+=noinsert
|
||||
let g:autocompletion = v:true
|
||||
|
||||
func Test_ins_complete_no_halt()
|
||||
function! OpenCompletion()
|
||||
if pumvisible() && (g:autocompletion == v:true)
|
||||
call feedkeys("\<C-e>\<C-n>", "i")
|
||||
return
|
||||
endif
|
||||
if ((v:char >= 'a' && v:char <= 'z') || (v:char >= 'A' && v:char <= 'Z')) && (g:autocompletion == v:true)
|
||||
call feedkeys("\<C-n>", "i")
|
||||
redraw
|
||||
endif
|
||||
endfunction
|
||||
|
||||
autocmd InsertCharPre * noautocmd call OpenCompletion()
|
||||
|
||||
setlocal spell! spelllang=en_us
|
||||
|
||||
call feedkeys("iauto-complete-halt-test test test test test test test test test test test test test test test test test test test\<C-c>", "tx!")
|
||||
call assert_equal(["auto-complete-halt-test test test test test test test test test test test test test test test test test test test"], getline(1, "$"))
|
||||
endfunc
|
||||
|
||||
func Test_auto_complete_backwards_no_halt()
|
||||
function! OpenCompletion()
|
||||
if pumvisible() && (g:autocompletion == v:true)
|
||||
call feedkeys("\<C-e>\<C-p>", "i")
|
||||
return
|
||||
endif
|
||||
if ((v:char >= 'a' && v:char <= 'z') || (v:char >= 'A' && v:char <= 'Z')) && (g:autocompletion == v:true)
|
||||
call feedkeys("\<C-p>", "i")
|
||||
redraw
|
||||
endif
|
||||
endfunction
|
||||
|
||||
autocmd InsertCharPre * noautocmd call OpenCompletion()
|
||||
|
||||
setlocal spell! spelllang=en_us
|
||||
|
||||
call feedkeys("iauto-complete-halt-test test test test test test test test test test test test test test test test test test test\<C-c>", "tx!")
|
||||
call assert_equal(["auto-complete-halt-test test test test test test test test test test test test test test test test test test test"], getline(1, "$"))
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
@@ -320,4 +320,15 @@ func Test_number_rightleft()
|
||||
bw!
|
||||
endfunc
|
||||
|
||||
" This used to cause a divide by zero
|
||||
func Test_number_no_text_virtual_edit()
|
||||
vnew
|
||||
call setline(1, ['line one', 'line two'])
|
||||
set number virtualedit=all
|
||||
normal w
|
||||
4wincmd |
|
||||
normal j
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -975,6 +975,13 @@ func Test_fo_a_w()
|
||||
exe "normal f4xx"
|
||||
call assert_equal(['1 2 5 6 7 ', '8 9'], getline(1, 2))
|
||||
|
||||
" using "cw" leaves cursor in right spot
|
||||
call setline(1, ['Now we g whether that nation, or',
|
||||
\ 'any nation so conceived and,'])
|
||||
set fo=tcqa tw=35
|
||||
exe "normal 2G0cwx\<Esc>"
|
||||
call assert_equal(['Now we g whether that nation, or x', 'nation so conceived and,'], getline(1, 2))
|
||||
|
||||
set tw=0
|
||||
set fo&
|
||||
%bw!
|
||||
|
||||
@@ -191,6 +191,14 @@ func Test_saveas()
|
||||
close!
|
||||
enew | only
|
||||
call delete('Xfile')
|
||||
|
||||
" :saveas should detect and set the file type.
|
||||
syntax on
|
||||
saveas! Xsaveas.pl
|
||||
call assert_equal('perl', &filetype)
|
||||
syntax off
|
||||
%bw!
|
||||
call delete('Xsaveas.pl')
|
||||
endfunc
|
||||
|
||||
func Test_write_errors()
|
||||
|
||||
Reference in New Issue
Block a user