diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-07-17 13:11:46 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-17 13:51:46 +0800 |
commit | 656a1889ee48f5d48d248fb5b6b88e2a113c090f (patch) | |
tree | 71379fee2e2dd1dbcd4531a45264629b0aaf1cc2 | |
parent | 7e79cb56c5e2ebc34731764c5fa46bebfd5603e2 (diff) | |
download | rneovim-656a1889ee48f5d48d248fb5b6b88e2a113c090f.tar.gz rneovim-656a1889ee48f5d48d248fb5b6b88e2a113c090f.tar.bz2 rneovim-656a1889ee48f5d48d248fb5b6b88e2a113c090f.zip |
vim-patch:8.2.1984: cannot use :vimgrep in omni completion
Problem: Cannot use :vimgrep in omni completion, causing C completion to
fail.
Solution: Add the EX_LOCK_OK flag to :vimgrep. (closes vim/vim#7292)
https://github.com/vim/vim/commit/33aecb1f2c85711d53858b71f5f3c2cbe076435f
Cherry-pick Test_resize_from_copen() indent change from patch 8.2.1432.
-rw-r--r-- | src/nvim/ex_cmds.lua | 8 | ||||
-rw-r--r-- | src/nvim/testdir/test_quickfix.vim | 84 |
2 files changed, 76 insertions, 16 deletions
diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua index 3ccc45e9ab..a5ba5e0b30 100644 --- a/src/nvim/ex_cmds.lua +++ b/src/nvim/ex_cmds.lua @@ -1636,13 +1636,13 @@ module.cmds = { }, { command='lvimgrep', - flags=bit.bor(RANGE, BANG, NEEDARG, EXTRA, NOTRLCOM, TRLBAR, XFILE), + flags=bit.bor(RANGE, BANG, NEEDARG, EXTRA, NOTRLCOM, TRLBAR, XFILE, LOCK_OK), addr_type='ADDR_OTHER', func='ex_vimgrep', }, { command='lvimgrepadd', - flags=bit.bor(RANGE, BANG, NEEDARG, EXTRA, NOTRLCOM, TRLBAR, XFILE), + flags=bit.bor(RANGE, BANG, NEEDARG, EXTRA, NOTRLCOM, TRLBAR, XFILE, LOCK_OK), addr_type='ADDR_OTHER', func='ex_vimgrep', }, @@ -3073,13 +3073,13 @@ module.cmds = { }, { command='vimgrep', - flags=bit.bor(RANGE, BANG, NEEDARG, EXTRA, NOTRLCOM, TRLBAR, XFILE), + flags=bit.bor(RANGE, BANG, NEEDARG, EXTRA, NOTRLCOM, TRLBAR, XFILE, LOCK_OK), addr_type='ADDR_OTHER', func='ex_vimgrep', }, { command='vimgrepadd', - flags=bit.bor(RANGE, BANG, NEEDARG, EXTRA, NOTRLCOM, TRLBAR, XFILE), + flags=bit.bor(RANGE, BANG, NEEDARG, EXTRA, NOTRLCOM, TRLBAR, XFILE, LOCK_OK), addr_type='ADDR_OTHER', func='ex_vimgrep', }, diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index af70b37163..290fc488f1 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -3124,20 +3124,80 @@ func Test_file_from_copen() endfunc func Test_resize_from_copen() + augroup QF_Test + au! + au FileType qf resize 5 + augroup END + try + " This should succeed without any exception. No other buffers are + " involved in the autocmd. + copen + finally augroup QF_Test - au! - au FileType qf resize 5 + au! augroup END - try - " This should succeed without any exception. No other buffers are - " involved in the autocmd. - copen - finally - augroup QF_Test - au! - augroup END - augroup! QF_Test - endtry + augroup! QF_Test + endtry +endfunc + +func Test_vimgrep_with_textlock() + new + + " Simple way to execute something with "textwinlock" set. + " Check that vimgrep without jumping can be executed. + au InsertCharPre * vimgrep /RunTheTest/j runtest.vim + normal ax + let qflist = getqflist() + call assert_true(len(qflist) > 0) + call assert_match('RunTheTest', qflist[0].text) + call setqflist([], 'r') + au! InsertCharPre + + " Check that vimgrepadd without jumping can be executed. + au InsertCharPre * vimgrepadd /RunTheTest/j runtest.vim + normal ax + let qflist = getqflist() + call assert_true(len(qflist) > 0) + call assert_match('RunTheTest', qflist[0].text) + call setqflist([], 'r') + au! InsertCharPre + + " Check that lvimgrep without jumping can be executed. + au InsertCharPre * lvimgrep /RunTheTest/j runtest.vim + normal ax + let qflist = getloclist(0) + call assert_true(len(qflist) > 0) + call assert_match('RunTheTest', qflist[0].text) + call setloclist(0, [], 'r') + au! InsertCharPre + + " Check that lvimgrepadd without jumping can be executed. + au InsertCharPre * lvimgrepadd /RunTheTest/j runtest.vim + normal ax + let qflist = getloclist(0) + call assert_true(len(qflist) > 0) + call assert_match('RunTheTest', qflist[0].text) + call setloclist(0, [], 'r') + au! InsertCharPre + + " trying to jump will give an error + au InsertCharPre * vimgrep /RunTheTest/ runtest.vim + call assert_fails('normal ax', 'E565:') + au! InsertCharPre + + au InsertCharPre * vimgrepadd /RunTheTest/ runtest.vim + call assert_fails('normal ax', 'E565:') + au! InsertCharPre + + au InsertCharPre * lvimgrep /RunTheTest/ runtest.vim + call assert_fails('normal ax', 'E565:') + au! InsertCharPre + + au InsertCharPre * lvimgrepadd /RunTheTest/ runtest.vim + call assert_fails('normal ax', 'E565:') + au! InsertCharPre + + bwipe! endfunc " Tests for the quickfix buffer b:changedtick variable |