comparison src/testdir/test_global.vim @ 29481:34bb46847ba0 v9.0.0082

patch 9.0.0082: cannot interrupt global command from command line Commit: https://github.com/vim/vim/commit/3cfae39b087c2724991d385e5e8ee7d011aa8e99 Author: zeertzjq <zeertzjq@outlook.com> Date: Tue Jul 26 17:48:13 2022 +0100 patch 9.0.0082: cannot interrupt global command from command line Problem: Cannot interrupt global command from command line. Solution: Reset got_int in another place. (closes https://github.com/vim/vim/issues/10739)
author Bram Moolenaar <Bram@vim.org>
date Tue, 26 Jul 2022 19:00:03 +0200
parents 0fa3be75ddc7
children 2c169fec56f2
comparison
equal deleted inserted replaced
29480:44fddf8c1ea4 29481:34bb46847ba0
1 " Test for :global and :vglobal 1 " Test for :global and :vglobal
2 2
3 source check.vim 3 source check.vim
4 source term_util.vim
4 5
5 func Test_yank_put_clipboard() 6 func Test_yank_put_clipboard()
6 new 7 new
7 call setline(1, ['a', 'b', 'c']) 8 call setline(1, ['a', 'b', 'c'])
8 set clipboard=unnamed 9 set clipboard=unnamed
105 106
106 func Test_wrong_delimiter() 107 func Test_wrong_delimiter()
107 call assert_fails('g x^bxd', 'E146:') 108 call assert_fails('g x^bxd', 'E146:')
108 endfunc 109 endfunc
109 110
111 " Test for interrupting :global using Ctrl-C
112 func Test_interrupt_global()
113 CheckRunVimInTerminal
114 let lines =<< trim END
115 cnoremap ; <Cmd>sleep 10<CR>
116 call setline(1, repeat(['foo'], 5))
117 END
118 call writefile(lines, 'Xtest_interrupt_global')
119 let buf = RunVimInTerminal('-S Xtest_interrupt_global', {'rows': 6})
120
121 call term_sendkeys(buf, ":g/foo/norm :\<C-V>;\<CR>")
122 " Wait for :sleep to start
123 call term_wait(buf)
124 call term_sendkeys(buf, "\<C-C>")
125 call WaitForAssert({-> assert_match('Interrupted', term_getline(buf, 6))}, 1000)
126
127 " Also test in Ex mode
128 call term_sendkeys(buf, "gQg/foo/norm :\<C-V>;\<CR>")
129 " Wait for :sleep to start
130 call term_wait(buf)
131 call term_sendkeys(buf, "\<C-C>")
132 call WaitForAssert({-> assert_match('Interrupted', term_getline(buf, 5))}, 1000)
133
134 call StopVimInTerminal(buf)
135 call delete('Xtest_interrupt_global')
136 endfunc
137
110 " vim: shiftwidth=2 sts=2 expandtab 138 " vim: shiftwidth=2 sts=2 expandtab