Mercurial > vim
annotate src/testdir/test_input.vim @ 31164:7831da568864 v9.0.0916
patch 9.0.0916: getbufline() is inefficient for getting a single line
Commit: https://github.com/vim/vim/commit/ce30ccc06af7f2c03762e5b18dde37b26ea6ec42
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Nov 21 19:57:04 2022 +0000
patch 9.0.0916: getbufline() is inefficient for getting a single line
Problem: getbufline() is inefficient for getting a single line.
Solution: Add getbufoneline().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 21 Nov 2022 21:00:06 +0100 |
parents | 5da38c4ffe92 |
children |
rev | line source |
---|---|
29434
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
1 " Tests for character input and feedkeys() function. |
8485
675ec6cc9021
commit https://github.com/vim/vim/commit/74c5bbf13435a7ab1e3461078bbcb1200f0451e1
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
675ec6cc9021
commit https://github.com/vim/vim/commit/74c5bbf13435a7ab1e3461078bbcb1200f0451e1
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 func Test_feedkeys_x_with_empty_string() |
675ec6cc9021
commit https://github.com/vim/vim/commit/74c5bbf13435a7ab1e3461078bbcb1200f0451e1
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 new |
675ec6cc9021
commit https://github.com/vim/vim/commit/74c5bbf13435a7ab1e3461078bbcb1200f0451e1
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 call feedkeys("ifoo\<Esc>") |
675ec6cc9021
commit https://github.com/vim/vim/commit/74c5bbf13435a7ab1e3461078bbcb1200f0451e1
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 call assert_equal('', getline('.')) |
675ec6cc9021
commit https://github.com/vim/vim/commit/74c5bbf13435a7ab1e3461078bbcb1200f0451e1
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 call feedkeys('', 'x') |
675ec6cc9021
commit https://github.com/vim/vim/commit/74c5bbf13435a7ab1e3461078bbcb1200f0451e1
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 call assert_equal('foo', getline('.')) |
8808
6b70b9cdebfc
commit https://github.com/vim/vim/commit/9bd547aca41799605c3a3f83444f6725c2d6eda9
Christian Brabandt <cb@256bit.org>
parents:
8485
diff
changeset
|
9 |
6b70b9cdebfc
commit https://github.com/vim/vim/commit/9bd547aca41799605c3a3f83444f6725c2d6eda9
Christian Brabandt <cb@256bit.org>
parents:
8485
diff
changeset
|
10 " check it goes back to normal mode immediately. |
6b70b9cdebfc
commit https://github.com/vim/vim/commit/9bd547aca41799605c3a3f83444f6725c2d6eda9
Christian Brabandt <cb@256bit.org>
parents:
8485
diff
changeset
|
11 call feedkeys('i', 'x') |
6b70b9cdebfc
commit https://github.com/vim/vim/commit/9bd547aca41799605c3a3f83444f6725c2d6eda9
Christian Brabandt <cb@256bit.org>
parents:
8485
diff
changeset
|
12 call assert_equal('foo', getline('.')) |
8485
675ec6cc9021
commit https://github.com/vim/vim/commit/74c5bbf13435a7ab1e3461078bbcb1200f0451e1
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 quit! |
675ec6cc9021
commit https://github.com/vim/vim/commit/74c5bbf13435a7ab1e3461078bbcb1200f0451e1
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 endfunc |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
8808
diff
changeset
|
15 |
26875
e06cbcf4b94b
patch 8.2.3966: when using feedkeys() abbreviations may be blocked
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
16 func Test_feedkeys_with_abbreviation() |
e06cbcf4b94b
patch 8.2.3966: when using feedkeys() abbreviations may be blocked
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
17 new |
e06cbcf4b94b
patch 8.2.3966: when using feedkeys() abbreviations may be blocked
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
18 inoreabbrev trigger value |
e06cbcf4b94b
patch 8.2.3966: when using feedkeys() abbreviations may be blocked
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
19 call feedkeys("atrigger ", 'x') |
e06cbcf4b94b
patch 8.2.3966: when using feedkeys() abbreviations may be blocked
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
20 call feedkeys("atrigger ", 'x') |
e06cbcf4b94b
patch 8.2.3966: when using feedkeys() abbreviations may be blocked
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
21 call assert_equal('value value ', getline(1)) |
e06cbcf4b94b
patch 8.2.3966: when using feedkeys() abbreviations may be blocked
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
22 bwipe! |
e06cbcf4b94b
patch 8.2.3966: when using feedkeys() abbreviations may be blocked
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
23 iunabbrev trigger |
e06cbcf4b94b
patch 8.2.3966: when using feedkeys() abbreviations may be blocked
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
24 endfunc |
e06cbcf4b94b
patch 8.2.3966: when using feedkeys() abbreviations may be blocked
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
25 |
28668
53c608c7ea9e
patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents:
26875
diff
changeset
|
26 func Test_feedkeys_escape_special() |
53c608c7ea9e
patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents:
26875
diff
changeset
|
27 nnoremap … <Cmd>let g:got_ellipsis += 1<CR> |
53c608c7ea9e
patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents:
26875
diff
changeset
|
28 call feedkeys('…', 't') |
53c608c7ea9e
patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents:
26875
diff
changeset
|
29 call assert_equal('…', getcharstr()) |
53c608c7ea9e
patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents:
26875
diff
changeset
|
30 let g:got_ellipsis = 0 |
53c608c7ea9e
patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents:
26875
diff
changeset
|
31 call feedkeys('…', 'xt') |
53c608c7ea9e
patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents:
26875
diff
changeset
|
32 call assert_equal(1, g:got_ellipsis) |
53c608c7ea9e
patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents:
26875
diff
changeset
|
33 unlet g:got_ellipsis |
53c608c7ea9e
patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents:
26875
diff
changeset
|
34 nunmap … |
53c608c7ea9e
patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents:
26875
diff
changeset
|
35 endfunc |
53c608c7ea9e
patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents:
26875
diff
changeset
|
36 |
29434
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
37 func Test_input_simplify_ctrl_at() |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
38 new |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
39 " feeding unsimplified CTRL-@ should still trigger i_CTRL-@ |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
40 call feedkeys("ifoo\<Esc>A\<*C-@>x", 'xt') |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
41 call assert_equal('foofo', getline(1)) |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
42 bw! |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
43 endfunc |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
44 |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
45 func Test_input_simplify_noremap() |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
46 call feedkeys("i\<*C-M>", 'nx') |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
47 call assert_equal('', getline(1)) |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
48 call assert_equal([0, 2, 1, 0, 1], getcurpos()) |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
49 bw! |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
50 endfunc |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
51 |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
52 func Test_input_simplify_timedout() |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
53 inoremap <C-M>a b |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
54 call feedkeys("i\<*C-M>", 'xt') |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
55 call assert_equal('', getline(1)) |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
56 call assert_equal([0, 2, 1, 0, 1], getcurpos()) |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
57 iunmap <C-M>a |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
58 bw! |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
59 endfunc |
5da38c4ffe92
patch 9.0.0059: test file has wrong name
Bram Moolenaar <Bram@vim.org>
parents:
28668
diff
changeset
|
60 |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
8808
diff
changeset
|
61 " vim: shiftwidth=2 sts=2 expandtab |