Merge pull request #29713 from zeertzjq/vim-9.1.0585

vim-patch:partial:9.0.0418,9.1.0585
This commit is contained in:
zeertzjq 2024-07-15 06:34:26 +08:00 committed by GitHub
commit da9e938793
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,7 +8,7 @@ source view_util.vim
" file name. " file name.
func Test_cpo_a() func Test_cpo_a()
let save_cpo = &cpo let save_cpo = &cpo
call writefile(['one'], 'XfileCpoA') call writefile(['one'], 'XfileCpoA', 'D')
" Wipe out all the buffers, so that the alternate file is empty " Wipe out all the buffers, so that the alternate file is empty
edit Xfoo | %bw edit Xfoo | %bw
set cpo-=a set cpo-=a
@ -19,8 +19,7 @@ func Test_cpo_a()
set cpo+=a set cpo+=a
read XfileCpoA read XfileCpoA
call assert_equal('XfileCpoA', @#) call assert_equal('XfileCpoA', @#)
close! bw!
call delete('XfileCpoA')
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -40,7 +39,7 @@ func Test_cpo_A()
set cpo+=A set cpo+=A
write XcpoAfile2 write XcpoAfile2
call assert_equal('XcpoAfile2', @#) call assert_equal('XcpoAfile2', @#)
close! bw!
call delete('XcpoAfile2') call delete('XcpoAfile2')
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -82,7 +81,7 @@ func Test_cpo_B()
call assert_equal('abd ', getline(1)) call assert_equal('abd ', getline(1))
call feedkeys(":imap <buffer> x\<C-A>\<C-B>\"\<CR>", 'tx') call feedkeys(":imap <buffer> x\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"imap <buffer> x\k', @:) call assert_equal('"imap <buffer> x\k', @:)
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -97,28 +96,27 @@ func Test_cpo_c()
set cpo-=c set cpo-=c
exe "normal gg/abab\<CR>" exe "normal gg/abab\<CR>"
call assert_equal(5, searchcount().total) call assert_equal(5, searchcount().total)
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
" Test for the 'C' flag in 'cpo' (line continuation) " Test for the 'C' flag in 'cpo' (line continuation)
func Test_cpo_C() func Test_cpo_C()
let save_cpo = &cpo let save_cpo = &cpo
call writefile(['let l = [', '\ 1,', '\ 2]'], 'XfileCpoC') call writefile(['let l = [', '\ 1,', '\ 2]'], 'XfileCpoC', 'D')
set cpo-=C set cpo-=C
source XfileCpoC source XfileCpoC
call assert_equal([1, 2], g:l) call assert_equal([1, 2], g:l)
set cpo+=C set cpo+=C
call assert_fails('source XfileCpoC', ['E697:', 'E10:']) call assert_fails('source XfileCpoC', ['E697:', 'E10:'])
call delete('XfileCpoC')
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
" Test for the 'd' flag in 'cpo' (tags relative to the current file) " Test for the 'd' flag in 'cpo' (tags relative to the current file)
func Test_cpo_d() func Test_cpo_d()
let save_cpo = &cpo let save_cpo = &cpo
call mkdir('XdirCpoD') call mkdir('XdirCpoD', 'R')
call writefile(["one\tXfile1\t/^one$/"], 'tags') call writefile(["one\tXfile1\t/^one$/"], 'tags', 'D')
call writefile(["two\tXfile2\t/^two$/"], 'XdirCpoD/tags') call writefile(["two\tXfile2\t/^two$/"], 'XdirCpoD/tags')
set tags=./tags set tags=./tags
set cpo-=d set cpo-=d
@ -126,9 +124,8 @@ func Test_cpo_d()
call assert_equal('two', taglist('.*')[0].name) call assert_equal('two', taglist('.*')[0].name)
set cpo+=d set cpo+=d
call assert_equal('one', taglist('.*')[0].name) call assert_equal('one', taglist('.*')[0].name)
%bw! %bw!
call delete('tags')
call delete('XdirCpoD', 'rf')
set tags& set tags&
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -146,7 +143,7 @@ func Test_cpo_D()
exe "norm! 1gg0f\<c-k>!!" exe "norm! 1gg0f\<c-k>!!"
call assert_equal(1, col('.')) call assert_equal(1, col('.'))
set cpo-=D set cpo-=D
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -186,7 +183,7 @@ func Test_cpo_E()
call assert_beeps('exe "normal v\<C-A>"') call assert_beeps('exe "normal v\<C-A>"')
call assert_beeps('exe "normal v\<C-X>"') call assert_beeps('exe "normal v\<C-X>"')
set cpo-=E set cpo-=E
close! bw!
endfunc endfunc
" Test for the 'f' flag in 'cpo' (read in an empty buffer sets the file name) " Test for the 'f' flag in 'cpo' (read in an empty buffer sets the file name)
@ -216,7 +213,7 @@ func Test_cpo_F()
set cpo+=F set cpo+=F
write XfileCpoF write XfileCpoF
call assert_equal('XfileCpoF', @%) call assert_equal('XfileCpoF', @%)
close! bw!
call delete('XfileCpoF') call delete('XfileCpoF')
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -233,7 +230,7 @@ func Test_cpo_g()
" set cpo+=g " set cpo+=g
" edit " edit
" call assert_equal(1, line('.')) " call assert_equal(1, line('.'))
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -250,7 +247,7 @@ func Test_cpo_H()
" call setline(1, ' ') " call setline(1, ' ')
" normal! Ia " normal! Ia
" call assert_equal(' a ', getline(1)) " call assert_equal(' a ', getline(1))
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -269,7 +266,7 @@ func Test_cpo_I()
%d %d
exe "normal i one\<CR>\<Up>" exe "normal i one\<CR>\<Up>"
call assert_equal('', getline(2)) call assert_equal('', getline(2))
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -300,7 +297,7 @@ func Test_cpo_J()
normal ( normal (
call assert_equal(colnr, col('.')) call assert_equal(colnr, col('.'))
endfor endfor
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -322,7 +319,7 @@ func Test_cpo_l()
set cpo+=l set cpo+=l
exe 'normal gg/[\t]' .. "\<CR>" exe 'normal gg/[\t]' .. "\<CR>"
call assert_equal([4, 10], [col('.'), virtcol('.')]) call assert_equal([4, 10], [col('.'), virtcol('.')])
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -343,7 +340,7 @@ func Test_cpo_L()
call setline(1, 'abcdefghijklmnopqr') call setline(1, 'abcdefghijklmnopqr')
exe "normal 0gR\<Tab>" exe "normal 0gR\<Tab>"
call assert_equal("\<Tab>ijklmnopqr", getline(1)) call assert_equal("\<Tab>ijklmnopqr", getline(1))
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -381,7 +378,7 @@ func Test_cpo_M()
call cursor(2, 1) call cursor(2, 1)
call assert_beeps('normal %') call assert_beeps('normal %')
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -397,7 +394,7 @@ func Test_cpo_n()
set cpo+=n set cpo+=n
redraw! redraw!
call assert_equal('aaaa', Screenline(2)) call assert_equal('aaaa', Screenline(2))
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -414,7 +411,7 @@ func Test_cpo_o()
exe "normal /one/+2\<CR>" exe "normal /one/+2\<CR>"
normal n normal n
call assert_equal(5, line('.')) call assert_equal(5, line('.'))
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -423,14 +420,13 @@ func Test_cpo_O()
let save_cpo = &cpo let save_cpo = &cpo
new XfileCpoO new XfileCpoO
call setline(1, 'one') call setline(1, 'one')
call writefile(['two'], 'XfileCpoO') call writefile(['two'], 'XfileCpoO', 'D')
set cpo-=O set cpo-=O
call assert_fails('write', 'E13:') call assert_fails('write', 'E13:')
set cpo+=O set cpo+=O
write write
call assert_equal(['one'], readfile('XfileCpoO')) call assert_equal(['one'], readfile('XfileCpoO'))
close! bw!
call delete('XfileCpoO')
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -440,7 +436,7 @@ endfunc
" name) " name)
func Test_cpo_P() func Test_cpo_P()
let save_cpo = &cpo let save_cpo = &cpo
call writefile([], 'XfileCpoP') call writefile([], 'XfileCpoP', 'D')
new new
call setline(1, 'one') call setline(1, 'one')
set cpo+=F set cpo+=F
@ -452,7 +448,6 @@ func Test_cpo_P()
call assert_equal('XfileCpoP', @%) call assert_equal('XfileCpoP', @%)
bwipe! bwipe!
call delete('XfileCpoP')
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -469,7 +464,7 @@ func Test_cpo_q()
set cpo+=q set cpo+=q
normal gg4J normal gg4J
call assert_equal(4, col('.')) call assert_equal(4, col('.'))
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -490,7 +485,7 @@ func Test_cpo_r()
let @/ = 'three' let @/ = 'three'
normal 2G. normal 2G.
call assert_equal('abc three four', getline(2)) call assert_equal('abc three four', getline(2))
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -510,7 +505,7 @@ func Test_cpo_R()
3mark r 3mark r
%!sort %!sort
call assert_equal(0, line("'r")) call assert_equal(0, line("'r"))
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -537,8 +532,8 @@ func Test_cpo_S()
wincmd p wincmd p
call assert_equal(0, &autoindent) call assert_equal(0, &autoindent)
wincmd t wincmd t
close! bw!
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -557,7 +552,7 @@ func Test_cpo_u()
exe "normal iabc\<C-G>udef\<C-G>ughi" exe "normal iabc\<C-G>udef\<C-G>ughi"
normal uu normal uu
call assert_equal('abcdefghi', getline(1)) call assert_equal('abcdefghi', getline(1))
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -582,7 +577,7 @@ func Test_cpo_w()
call assert_equal('hereZZZare some words', getline('.')) call assert_equal('hereZZZare some words', getline('.'))
norm! 1gg2elcWYYY norm! 1gg2elcWYYY
call assert_equal('hereZZZare someYYYwords', getline('.')) call assert_equal('hereZZZare someYYYwords', getline('.'))
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -619,7 +614,7 @@ func Test_cpo_X()
normal ggRy normal ggRy
normal 4. normal 4.
call assert_equal('yyyyxxxaaaaa', getline(1)) call assert_equal('yyyyxxxaaaaa', getline(1))
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -638,14 +633,14 @@ func Test_cpo_y()
normal ggyy normal ggyy
normal 2G. normal 2G.
call assert_equal("two\n", @") call assert_equal("two\n", @")
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
" Test for the 'Z' flag in 'cpo' (write! resets 'readonly') " Test for the 'Z' flag in 'cpo' (write! resets 'readonly')
func Test_cpo_Z() func Test_cpo_Z()
let save_cpo = &cpo let save_cpo = &cpo
call writefile([], 'XfileCpoZ') call writefile([], 'XfileCpoZ', 'D')
new XfileCpoZ new XfileCpoZ
setlocal readonly setlocal readonly
set cpo-=Z set cpo-=Z
@ -655,8 +650,7 @@ func Test_cpo_Z()
setlocal readonly setlocal readonly
write! write!
call assert_equal(1, &readonly) call assert_equal(1, &readonly)
close! bw!
call delete('XfileCpoZ')
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -710,7 +704,7 @@ func Test_cpo_percent()
call assert_equal(15, col('.')) call assert_equal(15, col('.'))
normal 22|% normal 22|%
call assert_equal(27, col('.')) call assert_equal(27, col('.'))
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -727,7 +721,7 @@ func Test_cpo_minus()
call assert_beeps('normal 10k') call assert_beeps('normal 10k')
call assert_equal(3, line('.')) call assert_equal(3, line('.'))
call assert_fails(10, 'E16:') call assert_fails(10, 'E16:')
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -735,7 +729,7 @@ endfunc
" flag) " flag)
func Test_cpo_plus() func Test_cpo_plus()
let save_cpo = &cpo let save_cpo = &cpo
call writefile([], 'XfileCpoPlus') call writefile([], 'XfileCpoPlus', 'D')
new XfileCpoPlus new XfileCpoPlus
call setline(1, 'foo') call setline(1, 'foo')
write X1 write X1
@ -743,8 +737,7 @@ func Test_cpo_plus()
set cpo+=+ set cpo+=+
write X2 write X2
call assert_equal(0, &modified) call assert_equal(0, &modified)
close! bw!
call delete('XfileCpoPlus')
call delete('X1') call delete('X1')
call delete('X2') call delete('X2')
let &cpo = save_cpo let &cpo = save_cpo
@ -762,7 +755,7 @@ func Test_cpo_star()
" set cpo+=* " set cpo+=*
" *a " *a
" call assert_equal(1, x) " call assert_equal(1, x)
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -783,7 +776,7 @@ func Test_cpo_gt()
normal gg"Rye normal gg"Rye
normal "Rye normal "Rye
call assert_equal("\none\none", @r) call assert_equal("\none\none", @r)
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -816,7 +809,7 @@ func Test_cpo_semicolon()
call assert_equal('bbb y', getline(4)) call assert_equal('bbb y', getline(4))
call assert_equal('ccc', getline(5)) call assert_equal('ccc', getline(5))
call assert_equal('ddd yee y', getline(6)) call assert_equal('ddd yee y', getline(6))
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -842,7 +835,7 @@ func Test_cpo_hash()
" call assert_equal(['', 'one', 'two', 'three'], getline(1, '$')) " call assert_equal(['', 'one', 'two', 'three'], getline(1, '$'))
" normal gg2Ozero " normal gg2Ozero
" call assert_equal(['zero', '', 'one', 'two', 'three'], getline(1, '$')) " call assert_equal(['zero', '', 'one', 'two', 'three'], getline(1, '$'))
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -850,7 +843,7 @@ endfunc
" loaded and ':preserve' is used. " loaded and ':preserve' is used.
func Test_cpo_ampersand() func Test_cpo_ampersand()
throw 'Skipped: Nvim does not support cpoptions flag "&"' throw 'Skipped: Nvim does not support cpoptions flag "&"'
call writefile(['one'], 'XfileCpoAmp') call writefile(['one'], 'XfileCpoAmp', 'D')
let after =<< trim [CODE] let after =<< trim [CODE]
set cpo+=& set cpo+=&
preserve preserve
@ -860,7 +853,6 @@ func Test_cpo_ampersand()
call assert_equal(1, filereadable('.XfileCpoAmp.swp')) call assert_equal(1, filereadable('.XfileCpoAmp.swp'))
call delete('.XfileCpoAmp.swp') call delete('.XfileCpoAmp.swp')
endif endif
call delete('XfileCpoAmp')
endfunc endfunc
" Test for the '\' flag in 'cpo' (backslash in a [] range in a search pattern) " Test for the '\' flag in 'cpo' (backslash in a [] range in a search pattern)
@ -875,7 +867,7 @@ func Test_cpo_backslash()
" set cpo+=\ " set cpo+=\
" exe 'normal gg/[ \-]' .. "\<CR>n" " exe 'normal gg/[ \-]' .. "\<CR>n"
" call assert_equal(2, col('.')) " call assert_equal(2, col('.'))
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -898,7 +890,7 @@ func Test_cpo_brace()
" call assert_equal(2, line('.')) " call assert_equal(2, line('.'))
" normal G{ " normal G{
" call assert_equal(2, line('.')) " call assert_equal(2, line('.'))
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@ -927,7 +919,7 @@ func Test_cpo_dot()
call delete('Xfoo') call delete('Xfoo')
set cpo& set cpo&
close! bw!
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc