diff src/testdir/test_quickfix.vim @ 32501:35fea638cd29 v9.0.1582

patch 9.0.1582: :stopinsert may not work in a popup close handler Commit: https://github.com/vim/vim/commit/a40c0bcc83c32da02869f59b10538d6327df61c5 Author: zeertzjq <zeertzjq@outlook.com> Date: Sat May 27 14:10:08 2023 +0100 patch 9.0.1582: :stopinsert may not work in a popup close handler Problem: :stopinsert may not work in a popup close handler. (Ben Jackson) Solution: Restore stop_insert_mode when appropriate. (closes https://github.com/vim/vim/issues/12452, closes #12434)
author Bram Moolenaar <Bram@vim.org>
date Sat, 27 May 2023 15:15:04 +0200
parents dbec60b8c253
children b5d8d556ea7f
line wrap: on
line diff
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -6404,5 +6404,28 @@ func Test_setqflist_cb_arg()
   call setqflist([], 'f')
 endfunc
 
+" Test that setqflist() should not prevent :stopinsert from working
+func Test_setqflist_stopinsert()
+  new
+  call setqflist([], 'f')
+  copen
+  cclose
+  func StopInsert()
+    stopinsert
+    call setqflist([{'text': 'foo'}])
+    return ''
+  endfunc
+
+  call setline(1, 'abc')
+  call cursor(1, 1)
+  call feedkeys("i\<C-R>=StopInsert()\<CR>$", 'tnix')
+  call assert_equal('foo', getqflist()[0].text)
+  call assert_equal([0, 1, 3, 0, v:maxcol], getcurpos())
+  call assert_equal(['abc'], getline(1, '$'))
+
+  delfunc StopInsert
+  call setqflist([], 'f')
+  bwipe!
+endfunc
 
 " vim: shiftwidth=2 sts=2 expandtab