mirror of
https://github.com/neovim/neovim.git
synced 2024-09-17 20:58:20 -04:00
Merge PR #11291 from shanesmith/vim-8.1.1256-take2
This commit is contained in:
commit
610755ff62
@ -1164,11 +1164,13 @@ tag command action ~
|
||||
|:cNfile| :cNf[ile] go to last error in previous file
|
||||
|:cabbrev| :ca[bbrev] like ":abbreviate" but 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
|
||||
|:caddexpr| :cadde[xpr] add errors from expr
|
||||
|:caddfile| :caddf[ile] add error message to current quickfix list
|
||||
|:call| :cal[l] call a function
|
||||
|: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
|
||||
|:cbuffer| :cb[uffer] parse error messages and jump to first error
|
||||
|:cc| :cc go to specific error
|
||||
@ -1325,12 +1327,14 @@ tag command action ~
|
||||
|:lNext| :lN[ext] go to previous entry in location list
|
||||
|:lNfile| :lNf[ile] go to last entry in previous file
|
||||
|:list| :l[ist] print lines
|
||||
|:labove| :lab[ove] go to location above current line
|
||||
|:laddexpr| :lad[dexpr] add locations from expr
|
||||
|:laddbuffer| :laddb[uffer] add locations from buffer
|
||||
|:laddfile| :laddf[ile] add locations to current location list
|
||||
|:last| :la[st] go to the last file in the argument list
|
||||
|:language| :lan[guage] set the language (locale)
|
||||
|: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
|
||||
|:lbuffer| :lb[uffer] parse locations and jump to first location
|
||||
|:lcd| :lc[d] change directory locally
|
||||
|
@ -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
|
||||
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*
|
||||
:[count]cnf[ile][!] Display the first error in the [count] next file in
|
||||
the list that includes a file name. If there are no
|
||||
|
@ -322,6 +322,12 @@ return {
|
||||
addr_type=ADDR_LINES,
|
||||
func='ex_abclear',
|
||||
},
|
||||
{
|
||||
command='cabove',
|
||||
flags=bit.bor(RANGE, TRLBAR),
|
||||
addr_type=ADDR_OTHER ,
|
||||
func='ex_cbelow',
|
||||
},
|
||||
{
|
||||
command='caddbuffer',
|
||||
flags=bit.bor(RANGE, NOTADR, WORD1, TRLBAR),
|
||||
@ -358,6 +364,12 @@ return {
|
||||
addr_type=ADDR_LINES,
|
||||
func='ex_cbuffer',
|
||||
},
|
||||
{
|
||||
command='cbelow',
|
||||
flags=bit.bor(RANGE, TRLBAR),
|
||||
addr_type=ADDR_OTHER ,
|
||||
func='ex_cbelow',
|
||||
},
|
||||
{
|
||||
command='cbottom',
|
||||
flags=bit.bor(TRLBAR),
|
||||
@ -1272,6 +1284,12 @@ return {
|
||||
addr_type=ADDR_LINES,
|
||||
func='ex_last',
|
||||
},
|
||||
{
|
||||
command='labove',
|
||||
flags=bit.bor(RANGE, TRLBAR),
|
||||
addr_type=ADDR_OTHER ,
|
||||
func='ex_cbelow',
|
||||
},
|
||||
{
|
||||
command='language',
|
||||
flags=bit.bor(EXTRA, TRLBAR, CMDWIN),
|
||||
@ -1308,6 +1326,12 @@ return {
|
||||
addr_type=ADDR_LINES,
|
||||
func='ex_cbuffer',
|
||||
},
|
||||
{
|
||||
command='lbelow',
|
||||
flags=bit.bor(RANGE, TRLBAR),
|
||||
addr_type=ADDR_OTHER ,
|
||||
func='ex_cbelow',
|
||||
},
|
||||
{
|
||||
command='lbottom',
|
||||
flags=bit.bor(TRLBAR),
|
||||
|
@ -693,6 +693,8 @@ void free_all_mem(void)
|
||||
|
||||
clear_hl_tables(false);
|
||||
list_free_log();
|
||||
|
||||
check_quickfix_busy();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
2459
src/nvim/quickfix.c
2459
src/nvim/quickfix.c
File diff suppressed because it is too large
Load Diff
@ -37,6 +37,8 @@ func s:setup_commands(cchar)
|
||||
command! -nargs=* Xgrepadd <mods> grepadd <args>
|
||||
command! -nargs=* Xhelpgrep helpgrep <args>
|
||||
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:Xsetlist = function('setqflist')
|
||||
call setqflist([], 'f')
|
||||
@ -70,6 +72,8 @@ func s:setup_commands(cchar)
|
||||
command! -nargs=* Xgrepadd <mods> lgrepadd <args>
|
||||
command! -nargs=* Xhelpgrep lhelpgrep <args>
|
||||
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:Xsetlist = function('setloclist', [0])
|
||||
call setloclist(0, [], 'f')
|
||||
@ -163,6 +167,12 @@ endfunc
|
||||
func XageTests(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}]
|
||||
call g:Xsetlist(list)
|
||||
|
||||
@ -561,6 +571,8 @@ func s:test_xhelpgrep(cchar)
|
||||
|
||||
" Search for non existing help string
|
||||
call assert_fails('Xhelpgrep a1b2c3', 'E480:')
|
||||
" Invalid regular expression
|
||||
call assert_fails('Xhelpgrep \@<!', 'E480:')
|
||||
endfunc
|
||||
|
||||
func Test_helpgrep()
|
||||
@ -1066,8 +1078,8 @@ func Test_efm2()
|
||||
set efm=%f:%s
|
||||
cexpr 'Xtestfile:Line search text'
|
||||
let l = getqflist()
|
||||
call assert_equal(l[0].pattern, '^\VLine search text\$')
|
||||
call assert_equal(l[0].lnum, 0)
|
||||
call assert_equal('^\VLine search text\$', l[0].pattern)
|
||||
call assert_equal(0, l[0].lnum)
|
||||
|
||||
let l = split(execute('clist', ''), "\n")
|
||||
call assert_equal([' 1 Xtestfile:^\VLine search text\$: '], l)
|
||||
@ -3358,7 +3370,28 @@ func Test_lexpr_crash()
|
||||
augroup QF_Test
|
||||
au!
|
||||
augroup END
|
||||
|
||||
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
|
||||
|
||||
" The following test used to crash Vim
|
||||
@ -3809,4 +3842,110 @@ func Test_viscol()
|
||||
call delete('Xfile1')
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user