Merge PR #11291 from shanesmith/vim-8.1.1256-take2

This commit is contained in:
Marco Hinz 2019-11-04 12:28:31 +01:00 committed by GitHub
commit 610755ff62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1748 additions and 914 deletions

View File

@ -1164,11 +1164,13 @@ tag command action ~
|:cNfile| :cNf[ile] go to last error in previous file |:cNfile| :cNf[ile] go to last error in previous file
|:cabbrev| :ca[bbrev] like ":abbreviate" but for Command-line mode |:cabbrev| :ca[bbrev] like ":abbreviate" but for Command-line mode
|:cabclear| :cabc[lear] clear all abbreviations for Command-line mode |:cabclear| :cabc[lear] clear all abbreviations for Command-line mode
|:cabove| :cabo[ve] go to error above current line
|:caddbuffer| :cad[dbuffer] add errors from buffer |:caddbuffer| :cad[dbuffer] add errors from buffer
|:caddexpr| :cadde[xpr] add errors from expr |:caddexpr| :cadde[xpr] add errors from expr
|:caddfile| :caddf[ile] add error message to current quickfix list |:caddfile| :caddf[ile] add error message to current quickfix list
|:call| :cal[l] call a function |:call| :cal[l] call a function
|:catch| :cat[ch] part of a :try command |:catch| :cat[ch] part of a :try command
|:cbelow| :cbe[low] got to error below current line
|:cbottom| :cbo[ttom] scroll to the bottom of the quickfix window |:cbottom| :cbo[ttom] scroll to the bottom of the quickfix window
|:cbuffer| :cb[uffer] parse error messages and jump to first error |:cbuffer| :cb[uffer] parse error messages and jump to first error
|:cc| :cc go to specific error |:cc| :cc go to specific error
@ -1325,12 +1327,14 @@ tag command action ~
|:lNext| :lN[ext] go to previous entry in location list |:lNext| :lN[ext] go to previous entry in location list
|:lNfile| :lNf[ile] go to last entry in previous file |:lNfile| :lNf[ile] go to last entry in previous file
|:list| :l[ist] print lines |:list| :l[ist] print lines
|:labove| :lab[ove] go to location above current line
|:laddexpr| :lad[dexpr] add locations from expr |:laddexpr| :lad[dexpr] add locations from expr
|:laddbuffer| :laddb[uffer] add locations from buffer |:laddbuffer| :laddb[uffer] add locations from buffer
|:laddfile| :laddf[ile] add locations to current location list |:laddfile| :laddf[ile] add locations to current location list
|:last| :la[st] go to the last file in the argument list |:last| :la[st] go to the last file in the argument list
|:language| :lan[guage] set the language (locale) |:language| :lan[guage] set the language (locale)
|:later| :lat[er] go to newer change, redo |:later| :lat[er] go to newer change, redo
|:lbelow| :lbe[low] go to location below current line
|:lbottom| :lbo[ttom] scroll to the bottom of the location window |:lbottom| :lbo[ttom] scroll to the bottom of the location window
|:lbuffer| :lb[uffer] parse locations and jump to first location |:lbuffer| :lb[uffer] parse locations and jump to first location
|:lcd| :lc[d] change directory locally |:lcd| :lc[d] change directory locally

View File

@ -109,6 +109,36 @@ processing a quickfix or location list command, it will be aborted.
list for the current window is used instead of the list for the current window is used instead of the
quickfix list. quickfix list.
*:cabo* *:cabove*
:[count]cabo[ve] Go to the [count] error above the current line in the
current buffer. If [count] is omitted, then 1 is
used. If there are no errors, then an error message
is displayed. Assumes that the entries in a quickfix
list are sorted by their buffer number and line
number. If there are multiple errors on the same line,
then only the first entry is used. If [count] exceeds
the number of entries above the current line, then the
first error in the file is selected.
*:lab* *:labove*
:[count]lab[ove] Same as ":cabove", except the location list for the
current window is used instead of the quickfix list.
*:cbe* *:cbelow*
:[count]cbe[low] Go to the [count] error below the current line in the
current buffer. If [count] is omitted, then 1 is
used. If there are no errors, then an error message
is displayed. Assumes that the entries in a quickfix
list are sorted by their buffer number and line
number. If there are multiple errors on the same
line, then only the first entry is used. If [count]
exceeds the number of entries below the current line,
then the last error in the file is selected.
*:lbe* *:lbelow*
:[count]lbe[low] Same as ":cbelow", except the location list for the
current window is used instead of the quickfix list.
*:cnf* *:cnfile* *:cnf* *:cnfile*
:[count]cnf[ile][!] Display the first error in the [count] next file in :[count]cnf[ile][!] Display the first error in the [count] next file in
the list that includes a file name. If there are no the list that includes a file name. If there are no

View File

@ -322,6 +322,12 @@ return {
addr_type=ADDR_LINES, addr_type=ADDR_LINES,
func='ex_abclear', func='ex_abclear',
}, },
{
command='cabove',
flags=bit.bor(RANGE, TRLBAR),
addr_type=ADDR_OTHER ,
func='ex_cbelow',
},
{ {
command='caddbuffer', command='caddbuffer',
flags=bit.bor(RANGE, NOTADR, WORD1, TRLBAR), flags=bit.bor(RANGE, NOTADR, WORD1, TRLBAR),
@ -358,6 +364,12 @@ return {
addr_type=ADDR_LINES, addr_type=ADDR_LINES,
func='ex_cbuffer', func='ex_cbuffer',
}, },
{
command='cbelow',
flags=bit.bor(RANGE, TRLBAR),
addr_type=ADDR_OTHER ,
func='ex_cbelow',
},
{ {
command='cbottom', command='cbottom',
flags=bit.bor(TRLBAR), flags=bit.bor(TRLBAR),
@ -1272,6 +1284,12 @@ return {
addr_type=ADDR_LINES, addr_type=ADDR_LINES,
func='ex_last', func='ex_last',
}, },
{
command='labove',
flags=bit.bor(RANGE, TRLBAR),
addr_type=ADDR_OTHER ,
func='ex_cbelow',
},
{ {
command='language', command='language',
flags=bit.bor(EXTRA, TRLBAR, CMDWIN), flags=bit.bor(EXTRA, TRLBAR, CMDWIN),
@ -1308,6 +1326,12 @@ return {
addr_type=ADDR_LINES, addr_type=ADDR_LINES,
func='ex_cbuffer', func='ex_cbuffer',
}, },
{
command='lbelow',
flags=bit.bor(RANGE, TRLBAR),
addr_type=ADDR_OTHER ,
func='ex_cbelow',
},
{ {
command='lbottom', command='lbottom',
flags=bit.bor(TRLBAR), flags=bit.bor(TRLBAR),

View File

@ -693,6 +693,8 @@ void free_all_mem(void)
clear_hl_tables(false); clear_hl_tables(false);
list_free_log(); list_free_log();
check_quickfix_busy();
} }
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -37,6 +37,8 @@ func s:setup_commands(cchar)
command! -nargs=* Xgrepadd <mods> grepadd <args> command! -nargs=* Xgrepadd <mods> grepadd <args>
command! -nargs=* Xhelpgrep helpgrep <args> command! -nargs=* Xhelpgrep helpgrep <args>
command! -nargs=0 -count Xcc <count>cc command! -nargs=0 -count Xcc <count>cc
command! -count=1 -nargs=0 Xbelow <mods><count>cbelow
command! -count=1 -nargs=0 Xabove <mods><count>cabove
let g:Xgetlist = function('getqflist') let g:Xgetlist = function('getqflist')
let g:Xsetlist = function('setqflist') let g:Xsetlist = function('setqflist')
call setqflist([], 'f') call setqflist([], 'f')
@ -70,6 +72,8 @@ func s:setup_commands(cchar)
command! -nargs=* Xgrepadd <mods> lgrepadd <args> command! -nargs=* Xgrepadd <mods> lgrepadd <args>
command! -nargs=* Xhelpgrep lhelpgrep <args> command! -nargs=* Xhelpgrep lhelpgrep <args>
command! -nargs=0 -count Xcc <count>ll command! -nargs=0 -count Xcc <count>ll
command! -count=1 -nargs=0 Xbelow <mods><count>lbelow
command! -count=1 -nargs=0 Xabove <mods><count>labove
let g:Xgetlist = function('getloclist', [0]) let g:Xgetlist = function('getloclist', [0])
let g:Xsetlist = function('setloclist', [0]) let g:Xsetlist = function('setloclist', [0])
call setloclist(0, [], 'f') call setloclist(0, [], 'f')
@ -163,6 +167,12 @@ endfunc
func XageTests(cchar) func XageTests(cchar)
call s:setup_commands(a:cchar) call s:setup_commands(a:cchar)
if a:cchar == 'l'
" No location list for the current window
call assert_fails('lolder', 'E776:')
call assert_fails('lnewer', 'E776:')
endif
let list = [{'bufnr': bufnr('%'), 'lnum': 1}] let list = [{'bufnr': bufnr('%'), 'lnum': 1}]
call g:Xsetlist(list) call g:Xsetlist(list)
@ -561,6 +571,8 @@ func s:test_xhelpgrep(cchar)
" Search for non existing help string " Search for non existing help string
call assert_fails('Xhelpgrep a1b2c3', 'E480:') call assert_fails('Xhelpgrep a1b2c3', 'E480:')
" Invalid regular expression
call assert_fails('Xhelpgrep \@<!', 'E480:')
endfunc endfunc
func Test_helpgrep() func Test_helpgrep()
@ -1066,8 +1078,8 @@ func Test_efm2()
set efm=%f:%s set efm=%f:%s
cexpr 'Xtestfile:Line search text' cexpr 'Xtestfile:Line search text'
let l = getqflist() let l = getqflist()
call assert_equal(l[0].pattern, '^\VLine search text\$') call assert_equal('^\VLine search text\$', l[0].pattern)
call assert_equal(l[0].lnum, 0) call assert_equal(0, l[0].lnum)
let l = split(execute('clist', ''), "\n") let l = split(execute('clist', ''), "\n")
call assert_equal([' 1 Xtestfile:^\VLine search text\$: '], l) call assert_equal([' 1 Xtestfile:^\VLine search text\$: '], l)
@ -3358,7 +3370,28 @@ func Test_lexpr_crash()
augroup QF_Test augroup QF_Test
au! au!
augroup END augroup END
enew | only enew | only
augroup QF_Test
au!
au BufNew * call setloclist(0, [], 'f')
augroup END
lexpr 'x:1:x'
augroup QF_Test
au!
augroup END
enew | only
lexpr ''
lopen
augroup QF_Test
au!
au FileType * call setloclist(0, [], 'f')
augroup END
lexpr ''
augroup QF_Test
au!
augroup END
endfunc endfunc
" The following test used to crash Vim " The following test used to crash Vim
@ -3809,4 +3842,110 @@ func Test_viscol()
call delete('Xfile1') call delete('Xfile1')
endfunc endfunc
" Test for the :cbelow, :cabove, :lbelow and :labove commands.
func Xtest_below(cchar)
call s:setup_commands(a:cchar)
" No quickfix/location list
call assert_fails('Xbelow', 'E42:')
call assert_fails('Xabove', 'E42:')
" Empty quickfix/location list
call g:Xsetlist([])
call assert_fails('Xbelow', 'E42:')
call assert_fails('Xabove', 'E42:')
call s:create_test_file('X1')
call s:create_test_file('X2')
call s:create_test_file('X3')
call s:create_test_file('X4')
" Invalid entries
edit X1
call g:Xsetlist(["E1", "E2"])
call assert_fails('Xbelow', 'E42:')
call assert_fails('Xabove', 'E42:')
call assert_fails('3Xbelow', 'E42:')
call assert_fails('4Xabove', 'E42:')
" Test the commands with various arguments
Xexpr ["X1:5:L5", "X2:5:L5", "X2:10:L10", "X2:15:L15", "X3:3:L3"]
edit +7 X2
Xabove
call assert_equal(['X2', 5], [bufname(''), line('.')])
call assert_fails('Xabove', 'E553:')
normal 2j
Xbelow
call assert_equal(['X2', 10], [bufname(''), line('.')])
" Last error in this file
Xbelow 99
call assert_equal(['X2', 15], [bufname(''), line('.')])
call assert_fails('Xbelow', 'E553:')
" First error in this file
Xabove 99
call assert_equal(['X2', 5], [bufname(''), line('.')])
call assert_fails('Xabove', 'E553:')
normal gg
Xbelow 2
call assert_equal(['X2', 10], [bufname(''), line('.')])
normal G
Xabove 2
call assert_equal(['X2', 10], [bufname(''), line('.')])
edit X4
call assert_fails('Xabove', 'E42:')
call assert_fails('Xbelow', 'E42:')
if a:cchar == 'l'
" If a buffer has location list entries from some other window but not
" from the current window, then the commands should fail.
edit X1 | split | call setloclist(0, [], 'f')
call assert_fails('Xabove', 'E776:')
call assert_fails('Xbelow', 'E776:')
close
endif
" Test for lines with multiple quickfix entries
Xexpr ["X1:5:L5", "X2:5:1:L5_1", "X2:5:2:L5_2", "X2:5:3:L5_3",
\ "X2:10:1:L10_1", "X2:10:2:L10_2", "X2:10:3:L10_3",
\ "X2:15:1:L15_1", "X2:15:2:L15_2", "X2:15:3:L15_3", "X3:3:L3"]
edit +1 X2
Xbelow 2
call assert_equal(['X2', 10, 1], [bufname(''), line('.'), col('.')])
normal gg
Xbelow 99
call assert_equal(['X2', 15, 1], [bufname(''), line('.'), col('.')])
normal G
Xabove 2
call assert_equal(['X2', 10, 1], [bufname(''), line('.'), col('.')])
normal G
Xabove 99
call assert_equal(['X2', 5, 1], [bufname(''), line('.'), col('.')])
normal 10G
Xabove
call assert_equal(['X2', 5, 1], [bufname(''), line('.'), col('.')])
normal 10G
Xbelow
call assert_equal(['X2', 15, 1], [bufname(''), line('.'), col('.')])
" Invalid range
if a:cchar == 'c'
call assert_fails('-2cbelow', 'E553:')
" TODO: should go to first error in the current line?
0cabove
else
call assert_fails('-2lbelow', 'E553:')
" TODO: should go to first error in the current line?
0labove
endif
call delete('X1')
call delete('X2')
call delete('X3')
call delete('X4')
endfunc
func Test_cbelow()
call Xtest_below('c')
call Xtest_below('l')
endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab