@@ -3091,6 +3091,66 @@ func Test_resize_from_copen()
30913091 endtry
30923092endfunc
30933093
3094+ func Test_vimgrep_with_textlock ()
3095+ new
3096+
3097+ " Simple way to execute something with "textwinlock" set.
3098+ " Check that vimgrep without jumping can be executed.
3099+ au InsertCharPre * vimgrep /RunTheTest/ j runtest.vim
3100+ normal ax
3101+ let qflist = getqflist ()
3102+ call assert_true (len (qflist) > 0 )
3103+ call assert_match (' RunTheTest' , qflist[0 ].text)
3104+ call setqflist ([], ' r' )
3105+ au ! InsertCharPre
3106+
3107+ " Check that vimgrepadd without jumping can be executed.
3108+ au InsertCharPre * vimgrepadd /RunTheTest/ j runtest.vim
3109+ normal ax
3110+ let qflist = getqflist ()
3111+ call assert_true (len (qflist) > 0 )
3112+ call assert_match (' RunTheTest' , qflist[0 ].text)
3113+ call setqflist ([], ' r' )
3114+ au ! InsertCharPre
3115+
3116+ " Check that lvimgrep without jumping can be executed.
3117+ au InsertCharPre * lvimgrep /RunTheTest/ j runtest.vim
3118+ normal ax
3119+ let qflist = getloclist (0 )
3120+ call assert_true (len (qflist) > 0 )
3121+ call assert_match (' RunTheTest' , qflist[0 ].text)
3122+ call setloclist (0 , [], ' r' )
3123+ au ! InsertCharPre
3124+
3125+ " Check that lvimgrepadd without jumping can be executed.
3126+ au InsertCharPre * lvimgrepadd /RunTheTest/ j runtest.vim
3127+ normal ax
3128+ let qflist = getloclist (0 )
3129+ call assert_true (len (qflist) > 0 )
3130+ call assert_match (' RunTheTest' , qflist[0 ].text)
3131+ call setloclist (0 , [], ' r' )
3132+ au ! InsertCharPre
3133+
3134+ " trying to jump will give an error
3135+ au InsertCharPre * vimgrep /RunTheTest/ runtest.vim
3136+ call assert_fails (' normal ax' , ' E565:' )
3137+ au ! InsertCharPre
3138+
3139+ au InsertCharPre * vimgrepadd /RunTheTest/ runtest.vim
3140+ call assert_fails (' normal ax' , ' E565:' )
3141+ au ! InsertCharPre
3142+
3143+ au InsertCharPre * lvimgrep /RunTheTest/ runtest.vim
3144+ call assert_fails (' normal ax' , ' E565:' )
3145+ au ! InsertCharPre
3146+
3147+ au InsertCharPre * lvimgrepadd /RunTheTest/ runtest.vim
3148+ call assert_fails (' normal ax' , ' E565:' )
3149+ au ! InsertCharPre
3150+
3151+ bwipe!
3152+ endfunc
3153+
30943154" Tests for the quickfix buffer b:changedtick variable
30953155func Xchangedtick_tests (cchar)
30963156 call s: setup_commands (a: cchar )
0 commit comments