Mercurial > vim
annotate src/testdir/test_global.vim @ 29718:538204fce2a4 v9.0.0199
patch 9.0.0199: cursor position wrong with two right-aligned virtual texts
Commit: https://github.com/vim/vim/commit/f0ccfa474a5c4940d03bfc6084e896dc8ac2d791
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 13 16:41:19 2022 +0100
patch 9.0.0199: cursor position wrong with two right-aligned virtual texts
Problem: Cursor position wrong with two right-aligned virtual texts.
Solution: Add the padding for right-alignment. (issue https://github.com/vim/vim/issues/10906)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 13 Aug 2022 17:45:03 +0200 |
parents | 34bb46847ba0 |
children | 2c169fec56f2 |
rev | line source |
---|---|
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
1 " Test for :global and :vglobal |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
2 |
20707
ec89debe5037
patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents:
19738
diff
changeset
|
3 source check.vim |
29481
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
4 source term_util.vim |
11273
96d83cd2904a
patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
96d83cd2904a
patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 func Test_yank_put_clipboard() |
96d83cd2904a
patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 new |
96d83cd2904a
patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 call setline(1, ['a', 'b', 'c']) |
96d83cd2904a
patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 set clipboard=unnamed |
96d83cd2904a
patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 g/^/normal yyp |
96d83cd2904a
patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 call assert_equal(['a', 'a', 'b', 'b', 'c', 'c'], getline(1, 6)) |
19738
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
12 set clipboard=unnamed,unnamedplus |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
13 call setline(1, ['a', 'b', 'c']) |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
14 g/^/normal yyp |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
15 call assert_equal(['a', 'a', 'b', 'b', 'c', 'c'], getline(1, 6)) |
11273
96d83cd2904a
patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 set clipboard& |
96d83cd2904a
patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 bwipe! |
96d83cd2904a
patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 endfunc |
11494
8e5ec22db3d8
patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents:
11273
diff
changeset
|
19 |
20707
ec89debe5037
patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents:
19738
diff
changeset
|
20 func Test_global_set_clipboard() |
ec89debe5037
patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents:
19738
diff
changeset
|
21 CheckFeature clipboard_working |
ec89debe5037
patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents:
19738
diff
changeset
|
22 new |
ec89debe5037
patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents:
19738
diff
changeset
|
23 set clipboard=unnamedplus |
ec89debe5037
patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents:
19738
diff
changeset
|
24 let @+='clipboard' | g/^/set cb= | let @" = 'unnamed' | put |
ec89debe5037
patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents:
19738
diff
changeset
|
25 call assert_equal(['','unnamed'], getline(1, '$')) |
ec89debe5037
patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents:
19738
diff
changeset
|
26 set clipboard& |
ec89debe5037
patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents:
19738
diff
changeset
|
27 bwipe! |
ec89debe5037
patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents:
19738
diff
changeset
|
28 endfunc |
ec89debe5037
patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents:
19738
diff
changeset
|
29 |
11494
8e5ec22db3d8
patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents:
11273
diff
changeset
|
30 func Test_nested_global() |
8e5ec22db3d8
patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents:
11273
diff
changeset
|
31 new |
8e5ec22db3d8
patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents:
11273
diff
changeset
|
32 call setline(1, ['nothing', 'found', 'found bad', 'bad']) |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
33 call assert_fails('g/found/3v/bad/s/^/++/', 'E147:') |
11494
8e5ec22db3d8
patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents:
11273
diff
changeset
|
34 g/found/v/bad/s/^/++/ |
8e5ec22db3d8
patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents:
11273
diff
changeset
|
35 call assert_equal(['nothing', '++found', 'found bad', 'bad'], getline(1, 4)) |
8e5ec22db3d8
patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents:
11273
diff
changeset
|
36 bwipe! |
8e5ec22db3d8
patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents:
11273
diff
changeset
|
37 endfunc |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
11494
diff
changeset
|
38 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
11494
diff
changeset
|
39 func Test_global_error() |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
11494
diff
changeset
|
40 call assert_fails('g\\a', 'E10:') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
11494
diff
changeset
|
41 call assert_fails('g', 'E148:') |
21265
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
20707
diff
changeset
|
42 call assert_fails('g/\(/y', 'E54:') |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
11494
diff
changeset
|
43 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
11494
diff
changeset
|
44 |
19277
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
45 " Test for printing lines using :g with different search patterns |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
46 func Test_global_print() |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
47 new |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
48 call setline(1, ['foo', 'bar', 'foo', 'foo']) |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
49 let @/ = 'foo' |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
50 let t = execute("g/")->trim()->split("\n") |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
51 call assert_equal(['foo', 'foo', 'foo'], t) |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
52 |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
53 " Test for Vi compatible patterns |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
54 let @/ = 'bar' |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
55 let t = execute('g\/')->trim()->split("\n") |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
56 call assert_equal(['bar'], t) |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
57 |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
58 normal gg |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
59 s/foo/foo/ |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
60 let t = execute('g\&')->trim()->split("\n") |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
61 call assert_equal(['foo', 'foo', 'foo'], t) |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
62 |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
63 let @/ = 'bar' |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
64 let t = execute('g?')->trim()->split("\n") |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
65 call assert_equal(['bar'], t) |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
66 |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
67 " Test for the 'Pattern found in every line' message |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
68 let v:statusmsg = '' |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
69 v/foo\|bar/p |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
70 call assert_notequal('', v:statusmsg) |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
71 |
27962
0fa3be75ddc7
patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents:
24992
diff
changeset
|
72 " In Vim9 script this is an error |
0fa3be75ddc7
patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents:
24992
diff
changeset
|
73 let caught = 'no' |
0fa3be75ddc7
patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents:
24992
diff
changeset
|
74 try |
0fa3be75ddc7
patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents:
24992
diff
changeset
|
75 vim9cmd v/foo\|bar/p |
0fa3be75ddc7
patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents:
24992
diff
changeset
|
76 catch /E538/ |
0fa3be75ddc7
patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents:
24992
diff
changeset
|
77 let caught = 'yes' |
0fa3be75ddc7
patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents:
24992
diff
changeset
|
78 call assert_match('E538: Pattern found in every line: foo\|bar', v:exception) |
0fa3be75ddc7
patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents:
24992
diff
changeset
|
79 endtry |
0fa3be75ddc7
patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents:
24992
diff
changeset
|
80 call assert_equal('yes', caught) |
0fa3be75ddc7
patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents:
24992
diff
changeset
|
81 |
0fa3be75ddc7
patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents:
24992
diff
changeset
|
82 " In Vim9 script not matching is an error |
0fa3be75ddc7
patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents:
24992
diff
changeset
|
83 let caught = 'no' |
0fa3be75ddc7
patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents:
24992
diff
changeset
|
84 try |
0fa3be75ddc7
patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents:
24992
diff
changeset
|
85 vim9cmd g/foobarnotfound/p |
0fa3be75ddc7
patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents:
24992
diff
changeset
|
86 catch /E486/ |
0fa3be75ddc7
patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents:
24992
diff
changeset
|
87 let caught = 'yes' |
0fa3be75ddc7
patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents:
24992
diff
changeset
|
88 call assert_match('E486: Pattern not found: foobarnotfound', v:exception) |
0fa3be75ddc7
patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents:
24992
diff
changeset
|
89 endtry |
0fa3be75ddc7
patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents:
24992
diff
changeset
|
90 call assert_equal('yes', caught) |
0fa3be75ddc7
patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents:
24992
diff
changeset
|
91 |
19277
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
92 close! |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
93 endfunc |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
94 |
19471
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19277
diff
changeset
|
95 " Test for global command with newline character |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19277
diff
changeset
|
96 func Test_global_newline() |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19277
diff
changeset
|
97 new |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19277
diff
changeset
|
98 call setline(1, ['foo']) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19277
diff
changeset
|
99 exe "g/foo/s/f/h/\<NL>s/o$/w/" |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19277
diff
changeset
|
100 call assert_equal('how', getline(1)) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19277
diff
changeset
|
101 call setline(1, ["foo\<NL>bar"]) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19277
diff
changeset
|
102 exe "g/foo/s/foo\\\<NL>bar/xyz/" |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19277
diff
changeset
|
103 call assert_equal('xyz', getline(1)) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19277
diff
changeset
|
104 close! |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19277
diff
changeset
|
105 endfunc |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19277
diff
changeset
|
106 |
24992
026718ffbfa8
patch 8.2.3033: no error when using alpha delimiter with :global
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
107 func Test_wrong_delimiter() |
026718ffbfa8
patch 8.2.3033: no error when using alpha delimiter with :global
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
108 call assert_fails('g x^bxd', 'E146:') |
026718ffbfa8
patch 8.2.3033: no error when using alpha delimiter with :global
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
109 endfunc |
026718ffbfa8
patch 8.2.3033: no error when using alpha delimiter with :global
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
110 |
29481
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
111 " Test for interrupting :global using Ctrl-C |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
112 func Test_interrupt_global() |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
113 CheckRunVimInTerminal |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
114 let lines =<< trim END |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
115 cnoremap ; <Cmd>sleep 10<CR> |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
116 call setline(1, repeat(['foo'], 5)) |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
117 END |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
118 call writefile(lines, 'Xtest_interrupt_global') |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
119 let buf = RunVimInTerminal('-S Xtest_interrupt_global', {'rows': 6}) |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
120 |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
121 call term_sendkeys(buf, ":g/foo/norm :\<C-V>;\<CR>") |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
122 " Wait for :sleep to start |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
123 call term_wait(buf) |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
124 call term_sendkeys(buf, "\<C-C>") |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
125 call WaitForAssert({-> assert_match('Interrupted', term_getline(buf, 6))}, 1000) |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
126 |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
127 " Also test in Ex mode |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
128 call term_sendkeys(buf, "gQg/foo/norm :\<C-V>;\<CR>") |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
129 " Wait for :sleep to start |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
130 call term_wait(buf) |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
131 call term_sendkeys(buf, "\<C-C>") |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
132 call WaitForAssert({-> assert_match('Interrupted', term_getline(buf, 5))}, 1000) |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
133 |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
134 call StopVimInTerminal(buf) |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
135 call delete('Xtest_interrupt_global') |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
136 endfunc |
34bb46847ba0
patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents:
27962
diff
changeset
|
137 |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
11494
diff
changeset
|
138 " vim: shiftwidth=2 sts=2 expandtab |