robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Justin M. Keyesfeat(exmode): "1q:", :exmode #41010fbcb7a056c

master
1.7 KiB46 linesraw
1local n = require('test.functional.testnvim')()
2local t = require('test.testutil')
3local Screen = require('test.functional.ui.screen')
4
5local describe, it, before_each = t.describe, t.it, t.before_each
6local clear = n.clear
7local exec = n.exec
8local feed = n.feed
9local poke_eventloop = n.poke_eventloop
10
11before_each(clear)
12
13describe(':global', function()
14  -- oldtest: Test_interrupt_global()
15  it('can be interrupted using Ctrl-C in cmdline mode vim-patch:9.0.0082', function()
16    local screen = Screen.new(75, 6)
17
18    exec([[
19      set nohlsearch noincsearch
20      cnoremap ; <Cmd>sleep 10<CR>
21      call setline(1, repeat(['foo'], 5))
22    ]])
23
24    feed(':g/foo/norm :<C-V>;<CR>')
25    poke_eventloop() -- Wait for :sleep to start
26    feed('<C-C>')
27    screen:expect([[
28      ^foo                                                                        |
29      foo                                                                        |*4
30      {9:Interrupted}                                                                |
31    ]])
32
33    -- Also test in Ex mode (keep-open cmdwin REPL)
34    feed('1q:g/foo/norm :<C-V>;<CR>')
35    poke_eventloop() -- Wait for :sleep to start
36    feed('<C-C>')
37    screen:expect([[
38      foo                                                                        |
39      {2:[No Name] [+]                                                              }|
40      {1::}" Keyboard interrupt                                                      |
41      {1::}^                                                                          |
42      {3:[Ex mode]                                                                  }|
43      {5:-- INSERT --}                                                               |
44    ]])
45  end)
46end)