]> granicus.if.org Git - vim/commitdiff
patch 8.2.1984: cannot use :vimgrep in omni completion v8.2.1984
authorBram Moolenaar <Bram@vim.org>
Sat, 14 Nov 2020 16:25:51 +0000 (17:25 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 14 Nov 2020 16:25:51 +0000 (17:25 +0100)
Problem:    Cannot use :vimgrep in omni completion, causing C completion to
            fail.
Solution:   Add the EX_LOCK_OK flag to :vimgrep. (closes #7292)

src/ex_cmds.h
src/testdir/test_quickfix.vim
src/version.c

index 4fe62cafe87c88b0559407d93961c83a710f54e8..88734843c69d2d8b9c6dc60576a4a1f3f4ad2961 100644 (file)
@@ -929,10 +929,10 @@ EXCMD(CMD_luafile,        "luafile",      ex_luafile,
        EX_RANGE|EX_FILE1|EX_NEEDARG|EX_CMDWIN|EX_LOCK_OK|EX_RESTRICT,
        ADDR_LINES),
 EXCMD(CMD_lvimgrep,    "lvimgrep",     ex_vimgrep,
-       EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE,
+       EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE|EX_LOCK_OK,
        ADDR_OTHER),
 EXCMD(CMD_lvimgrepadd, "lvimgrepadd",  ex_vimgrep,
-       EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE,
+       EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE|EX_LOCK_OK,
        ADDR_OTHER),
 EXCMD(CMD_lwindow,     "lwindow",      ex_cwindow,
        EX_RANGE|EX_COUNT|EX_TRLBAR,
@@ -1673,10 +1673,10 @@ EXCMD(CMD_view,         "view",         ex_edit,
        EX_BANG|EX_FILE1|EX_CMDARG|EX_ARGOPT|EX_TRLBAR,
        ADDR_NONE),
 EXCMD(CMD_vimgrep,     "vimgrep",      ex_vimgrep,
-       EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE,
+       EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE|EX_LOCK_OK,
        ADDR_OTHER),
 EXCMD(CMD_vimgrepadd,  "vimgrepadd",   ex_vimgrep,
-       EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE,
+       EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE|EX_LOCK_OK,
        ADDR_OTHER),
 EXCMD(CMD_vim9script,  "vim9script",   ex_vim9script,
        EX_CMDWIN|EX_LOCK_OK,
index 395ecc6e1cbdddd0d6e46c7b09f968ab97ab23be..cbdc610bb1bdd9c22f780252f89113fcdc5465e9 100644 (file)
@@ -3091,6 +3091,66 @@ func Test_resize_from_copen()
   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
 func Xchangedtick_tests(cchar)
   call s:setup_commands(a:cchar)
index 43cd9cb23beb430b7623b7ba13de153513135bd4..8d21a4aab4d084f061751f8893fa6d84913735da 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1984,
 /**/
     1983,
 /**/