Mercurial > vim
annotate src/testdir/test_search.vim @ 13576:8e08ded3a3e6
Added tag v8.0.1660 for changeset 4df23d9bad47cfda58d8da4a768f87fa1ad6170a
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 04 Apr 2018 23:00:08 +0200 |
parents | fe0cec169589 |
children | dd6a63e3e7c4 |
rev | line source |
---|---|
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test for the search command |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
12720
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
3 source shared.vim |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
4 |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 func Test_search_cmdline() |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 if !exists('+incsearch') |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 return |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 endif |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 " need to disable char_avail, |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 " so that expansion of commandline works |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
11 call test_override("char_avail", 1) |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 new |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 call setline(1, [' 1', ' 2 these', ' 3 the', ' 4 their', ' 5 there', ' 6 their', ' 7 the', ' 8 them', ' 9 these', ' 10 foobar']) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 " Test 1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 " CTRL-N / CTRL-P skips through the previous search history |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 set noincsearch |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 :1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 call feedkeys("/foobar\<cr>", 'tx') |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 call feedkeys("/the\<cr>",'tx') |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 call assert_equal('the', @/) |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
21 call feedkeys("/thes\<C-P>\<C-P>\<cr>",'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 call assert_equal('foobar', @/) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 " Test 2 |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
25 " Ctrl-G goes from one match to the next |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 " until the end of the buffer |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 set incsearch nowrapscan |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 :1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 " first match |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 call feedkeys("/the\<cr>", 'tx') |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 call assert_equal(' 2 these', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 :1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 " second match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
34 call feedkeys("/the\<C-G>\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 call assert_equal(' 3 the', getline('.')) |
10098
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
36 call assert_equal([0, 0, 0, 0], getpos('"')) |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 :1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 " third match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
39 call feedkeys("/the".repeat("\<C-G>", 2)."\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 call assert_equal(' 4 their', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 :1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 " fourth match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
43 call feedkeys("/the".repeat("\<C-G>", 3)."\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 call assert_equal(' 5 there', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 :1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 " fifth match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
47 call feedkeys("/the".repeat("\<C-G>", 4)."\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 call assert_equal(' 6 their', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 :1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 " sixth match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
51 call feedkeys("/the".repeat("\<C-G>", 5)."\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 call assert_equal(' 7 the', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 :1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 " seventh match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
55 call feedkeys("/the".repeat("\<C-G>", 6)."\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 call assert_equal(' 8 them', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 :1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 " eigth match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
59 call feedkeys("/the".repeat("\<C-G>", 7)."\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 call assert_equal(' 9 these', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 :1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 " no further match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
63 call feedkeys("/the".repeat("\<C-G>", 8)."\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 call assert_equal(' 9 these', getline('.')) |
10098
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
65 call assert_equal([0, 0, 0, 0], getpos('"')) |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 " Test 3 |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
68 " Ctrl-G goes from one match to the next |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 " and continues back at the top |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 set incsearch wrapscan |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 :1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 " first match |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 call feedkeys("/the\<cr>", 'tx') |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 call assert_equal(' 2 these', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 :1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 " second match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
77 call feedkeys("/the\<C-G>\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 call assert_equal(' 3 the', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 :1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 " third match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
81 call feedkeys("/the".repeat("\<C-G>", 2)."\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 call assert_equal(' 4 their', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 :1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 " fourth match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
85 call feedkeys("/the".repeat("\<C-G>", 3)."\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 call assert_equal(' 5 there', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 :1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 " fifth match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
89 call feedkeys("/the".repeat("\<C-G>", 4)."\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 call assert_equal(' 6 their', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
91 :1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 " sixth match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
93 call feedkeys("/the".repeat("\<C-G>", 5)."\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 call assert_equal(' 7 the', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 :1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 " seventh match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
97 call feedkeys("/the".repeat("\<C-G>", 6)."\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 call assert_equal(' 8 them', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
99 :1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
100 " eigth match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
101 call feedkeys("/the".repeat("\<C-G>", 7)."\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
102 call assert_equal(' 9 these', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 :1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
104 " back at first match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
105 call feedkeys("/the".repeat("\<C-G>", 8)."\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
106 call assert_equal(' 2 these', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
108 " Test 4 |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
109 " CTRL-T goes to the previous match |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
110 set incsearch nowrapscan |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
111 $ |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
112 " first match |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
113 call feedkeys("?the\<cr>", 'tx') |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
114 call assert_equal(' 9 these', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
115 $ |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
116 " first match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
117 call feedkeys("?the\<C-G>\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
118 call assert_equal(' 9 these', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
119 $ |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
120 " second match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
121 call feedkeys("?the".repeat("\<C-T>", 1)."\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
122 call assert_equal(' 8 them', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
123 $ |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
124 " last match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
125 call feedkeys("?the".repeat("\<C-T>", 7)."\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
126 call assert_equal(' 2 these', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
127 $ |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
128 " last match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
129 call feedkeys("?the".repeat("\<C-T>", 8)."\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
130 call assert_equal(' 2 these', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
131 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
132 " Test 5 |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
133 " CTRL-T goes to the previous match |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
134 set incsearch wrapscan |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
135 $ |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
136 " first match |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
137 call feedkeys("?the\<cr>", 'tx') |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
138 call assert_equal(' 9 these', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
139 $ |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
140 " first match at the top |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
141 call feedkeys("?the\<C-G>\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
142 call assert_equal(' 2 these', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
143 $ |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
144 " second match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
145 call feedkeys("?the".repeat("\<C-T>", 1)."\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
146 call assert_equal(' 8 them', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
147 $ |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
148 " last match |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
149 call feedkeys("?the".repeat("\<C-T>", 7)."\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
150 call assert_equal(' 2 these', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
151 $ |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
152 " back at the bottom of the buffer |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
153 call feedkeys("?the".repeat("\<C-T>", 8)."\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
154 call assert_equal(' 9 these', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
155 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
156 " Test 6 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
157 " CTRL-L adds to the search pattern |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
158 set incsearch wrapscan |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
159 1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
160 " first match |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
161 call feedkeys("/the\<c-l>\<cr>", 'tx') |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
162 call assert_equal(' 2 these', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
163 1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
164 " go to next match of 'thes' |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
165 call feedkeys("/the\<c-l>\<C-G>\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
166 call assert_equal(' 9 these', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
167 1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
168 " wrap around |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
169 call feedkeys("/the\<c-l>\<C-G>\<C-G>\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
170 call assert_equal(' 2 these', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
171 1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
172 " wrap around |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
173 set nowrapscan |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
174 call feedkeys("/the\<c-l>\<C-G>\<C-G>\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
175 call assert_equal(' 9 these', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
176 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 " Test 7 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
178 " <bs> remove from match, but stay at current match |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
179 set incsearch wrapscan |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
180 1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
181 " first match |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
182 call feedkeys("/thei\<cr>", 'tx') |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 call assert_equal(' 4 their', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
184 1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
185 " delete one char, add another |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
186 call feedkeys("/thei\<bs>s\<cr>", 'tx') |
10098
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
187 call assert_equal(' 2 these', getline('.')) |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
188 1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
189 " delete one char, add another, go to previous match, add one char |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
190 call feedkeys("/thei\<bs>s\<bs>\<C-T>\<c-l>\<cr>", 'tx') |
10098
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
191 call assert_equal(' 9 these', getline('.')) |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
192 1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
193 " delete all chars, start from the beginning again |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
194 call feedkeys("/them". repeat("\<bs>",4).'the\>'."\<cr>", 'tx') |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
195 call assert_equal(' 3 the', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
196 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
197 " clean up |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
198 call test_override("char_avail", 0) |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
199 bw! |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
200 endfunc |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
201 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
202 func Test_search_cmdline2() |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
203 if !exists('+incsearch') |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
204 return |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
205 endif |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
206 " need to disable char_avail, |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
207 " so that expansion of commandline works |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
208 call test_override("char_avail", 1) |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
209 new |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
210 call setline(1, [' 1', ' 2 these', ' 3 the theother']) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
211 " Test 1 |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
212 " Ctrl-T goes correctly back and forth |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
213 set incsearch |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
214 1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
215 " first match |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
216 call feedkeys("/the\<cr>", 'tx') |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
217 call assert_equal(' 2 these', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
218 1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
219 " go to next match (on next line) |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
220 call feedkeys("/the\<C-G>\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
221 call assert_equal(' 3 the theother', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
222 1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
223 " go to next match (still on line 3) |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
224 call feedkeys("/the\<C-G>\<C-G>\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
225 call assert_equal(' 3 the theother', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
226 1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
227 " go to next match (still on line 3) |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
228 call feedkeys("/the\<C-G>\<C-G>\<C-G>\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
229 call assert_equal(' 3 the theother', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
230 1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
231 " go to previous match (on line 3) |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
232 call feedkeys("/the\<C-G>\<C-G>\<C-G>\<C-T>\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
233 call assert_equal(' 3 the theother', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
234 1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
235 " go to previous match (on line 3) |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
236 call feedkeys("/the\<C-G>\<C-G>\<C-G>\<C-T>\<C-T>\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
237 call assert_equal(' 3 the theother', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
238 1 |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
239 " go to previous match (on line 2) |
9990
6a1793d9c895
commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents:
9971
diff
changeset
|
240 call feedkeys("/the\<C-G>\<C-G>\<C-G>\<C-T>\<C-T>\<C-T>\<cr>", 'tx') |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
241 call assert_equal(' 2 these', getline('.')) |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
242 |
10098
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
243 " Test 2: keep the view, |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
244 " after deleting a character from the search cmd |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
245 call setline(1, [' 1', ' 2 these', ' 3 the', ' 4 their', ' 5 there', ' 6 their', ' 7 the', ' 8 them', ' 9 these', ' 10 foobar']) |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
246 resize 5 |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
247 1 |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
248 call feedkeys("/foo\<bs>\<cr>", 'tx') |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
249 redraw |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
250 call assert_equal({'lnum': 10, 'leftcol': 0, 'col': 4, 'topfill': 0, 'topline': 6, 'coladd': 0, 'skipcol': 0, 'curswant': 4}, winsaveview()) |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
251 |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
252 " remove all history entries |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
253 for i in range(10) |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
254 call histdel('/') |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
255 endfor |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
256 |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
257 " Test 3: reset the view, |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
258 " after deleting all characters from the search cmd |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
259 norm! 1gg0 |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
260 " unfortunately, neither "/foo\<c-w>\<cr>", nor "/foo\<bs>\<bs>\<bs>\<cr>", |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
261 " nor "/foo\<c-u>\<cr>" works to delete the commandline. |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
262 " In that case Vim should return "E35 no previous regular expression", |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
263 " but it looks like Vim still sees /foo and therefore the test fails. |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
264 " Therefore, disableing this test |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
265 "call assert_fails(feedkeys("/foo\<c-w>\<cr>", 'tx'), 'E35') |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
266 "call assert_equal({'lnum': 1, 'leftcol': 0, 'col': 0, 'topfill': 0, 'topline': 1, 'coladd': 0, 'skipcol': 0, 'curswant': 0}, winsaveview()) |
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
267 |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
268 " clean up |
10098
72e4b7f90465
commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents:
9990
diff
changeset
|
269 set noincsearch |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
270 call test_override("char_avail", 0) |
9971
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
271 bw! |
98b39d2eb895
commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
272 endfunc |
10172
ab45de65977b
commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents:
10098
diff
changeset
|
273 |
ab45de65977b
commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents:
10098
diff
changeset
|
274 func Test_use_sub_pat() |
ab45de65977b
commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents:
10098
diff
changeset
|
275 split |
ab45de65977b
commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents:
10098
diff
changeset
|
276 let @/ = '' |
ab45de65977b
commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents:
10098
diff
changeset
|
277 func X() |
ab45de65977b
commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents:
10098
diff
changeset
|
278 s/^/a/ |
ab45de65977b
commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents:
10098
diff
changeset
|
279 / |
ab45de65977b
commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents:
10098
diff
changeset
|
280 endfunc |
ab45de65977b
commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents:
10098
diff
changeset
|
281 call X() |
ab45de65977b
commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents:
10098
diff
changeset
|
282 bwipe! |
ab45de65977b
commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents:
10098
diff
changeset
|
283 endfunc |
10514
1435e45ee6fa
commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents:
10172
diff
changeset
|
284 |
1435e45ee6fa
commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents:
10172
diff
changeset
|
285 func Test_searchpair() |
1435e45ee6fa
commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents:
10172
diff
changeset
|
286 new |
1435e45ee6fa
commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents:
10172
diff
changeset
|
287 call setline(1, ['other code here', '', '[', '" cursor here', ']']) |
1435e45ee6fa
commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents:
10172
diff
changeset
|
288 4 |
1435e45ee6fa
commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents:
10172
diff
changeset
|
289 let a=searchpair('\[','',']','bW') |
1435e45ee6fa
commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents:
10172
diff
changeset
|
290 call assert_equal(3, a) |
1435e45ee6fa
commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents:
10172
diff
changeset
|
291 set nomagic |
1435e45ee6fa
commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents:
10172
diff
changeset
|
292 4 |
1435e45ee6fa
commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents:
10172
diff
changeset
|
293 let a=searchpair('\[','',']','bW') |
1435e45ee6fa
commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents:
10172
diff
changeset
|
294 call assert_equal(3, a) |
1435e45ee6fa
commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents:
10172
diff
changeset
|
295 set magic |
1435e45ee6fa
commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents:
10172
diff
changeset
|
296 q! |
1435e45ee6fa
commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents:
10172
diff
changeset
|
297 endfunc |
1435e45ee6fa
commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents:
10172
diff
changeset
|
298 |
12722
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12720
diff
changeset
|
299 func Test_searchpair_skip() |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12720
diff
changeset
|
300 func Zero() |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12720
diff
changeset
|
301 return 0 |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12720
diff
changeset
|
302 endfunc |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12720
diff
changeset
|
303 func Partial(x) |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12720
diff
changeset
|
304 return a:x |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12720
diff
changeset
|
305 endfunc |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12720
diff
changeset
|
306 new |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12720
diff
changeset
|
307 call setline(1, ['{', 'foo', 'foo', 'foo', '}']) |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12720
diff
changeset
|
308 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', '')) |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12720
diff
changeset
|
309 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', '0')) |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12720
diff
changeset
|
310 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', {-> 0})) |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12720
diff
changeset
|
311 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', function('Zero'))) |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12720
diff
changeset
|
312 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', function('Partial', [0]))) |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12720
diff
changeset
|
313 " invalid argument |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12720
diff
changeset
|
314 3 | call assert_equal(0, searchpair('{', '', '}', 'bWn', 0)) |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12720
diff
changeset
|
315 bw! |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12720
diff
changeset
|
316 endfunc |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12720
diff
changeset
|
317 |
11018
654fc5636b37
patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents:
10514
diff
changeset
|
318 func Test_searchc() |
654fc5636b37
patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents:
10514
diff
changeset
|
319 " These commands used to cause memory overflow in searchc(). |
654fc5636b37
patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents:
10514
diff
changeset
|
320 new |
654fc5636b37
patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents:
10514
diff
changeset
|
321 norm ixx |
654fc5636b37
patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents:
10514
diff
changeset
|
322 exe "norm 0t\u93cf" |
654fc5636b37
patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents:
10514
diff
changeset
|
323 bw! |
654fc5636b37
patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents:
10514
diff
changeset
|
324 endfunc |
11613
7428a08c2f68
patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
325 |
7428a08c2f68
patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
326 func Test_search_cmdline3() |
7428a08c2f68
patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
327 if !exists('+incsearch') |
7428a08c2f68
patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
328 return |
7428a08c2f68
patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
329 endif |
7428a08c2f68
patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
330 " need to disable char_avail, |
7428a08c2f68
patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
331 " so that expansion of commandline works |
7428a08c2f68
patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
332 call test_override("char_avail", 1) |
7428a08c2f68
patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
333 new |
7428a08c2f68
patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
334 call setline(1, [' 1', ' 2 the~e', ' 3 the theother']) |
7428a08c2f68
patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
335 set incsearch |
7428a08c2f68
patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
336 1 |
7428a08c2f68
patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
337 " first match |
7428a08c2f68
patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
338 call feedkeys("/the\<c-l>\<cr>", 'tx') |
7428a08c2f68
patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
339 call assert_equal(' 2 the~e', getline('.')) |
7428a08c2f68
patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
340 " clean up |
7428a08c2f68
patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
341 set noincsearch |
7428a08c2f68
patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
342 call test_override("char_avail", 0) |
7428a08c2f68
patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
343 bw! |
7428a08c2f68
patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
344 endfunc |
11619
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
345 |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
346 func Test_search_cmdline4() |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
347 if !exists('+incsearch') |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
348 return |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
349 endif |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
350 " need to disable char_avail, |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
351 " so that expansion of commandline works |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
352 call test_override("char_avail", 1) |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
353 new |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
354 call setline(1, [' 1 the first', ' 2 the second', ' 3 the third']) |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
355 set incsearch |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
356 $ |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
357 call feedkeys("?the\<c-g>\<cr>", 'tx') |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
358 call assert_equal(' 3 the third', getline('.')) |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
359 $ |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
360 call feedkeys("?the\<c-g>\<c-g>\<cr>", 'tx') |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
361 call assert_equal(' 1 the first', getline('.')) |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
362 $ |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
363 call feedkeys("?the\<c-g>\<c-g>\<c-g>\<cr>", 'tx') |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
364 call assert_equal(' 2 the second', getline('.')) |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
365 $ |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
366 call feedkeys("?the\<c-t>\<cr>", 'tx') |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
367 call assert_equal(' 1 the first', getline('.')) |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
368 $ |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
369 call feedkeys("?the\<c-t>\<c-t>\<cr>", 'tx') |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
370 call assert_equal(' 3 the third', getline('.')) |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
371 $ |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
372 call feedkeys("?the\<c-t>\<c-t>\<c-t>\<cr>", 'tx') |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
373 call assert_equal(' 2 the second', getline('.')) |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
374 " clean up |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
375 set noincsearch |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
376 call test_override("char_avail", 0) |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
377 bw! |
80af4916eadc
patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents:
11613
diff
changeset
|
378 endfunc |
12560
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
379 |
12664
42cd1f315e8b
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
380 func Test_search_cmdline5() |
42cd1f315e8b
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
381 if !exists('+incsearch') |
42cd1f315e8b
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
382 return |
42cd1f315e8b
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
383 endif |
42cd1f315e8b
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
384 " Do not call test_override("char_avail", 1) so that <C-g> and <C-t> work |
42cd1f315e8b
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
385 " regardless char_avail. |
42cd1f315e8b
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
386 new |
42cd1f315e8b
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
387 call setline(1, [' 1 the first', ' 2 the second', ' 3 the third']) |
42cd1f315e8b
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
388 set incsearch |
42cd1f315e8b
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
389 1 |
42cd1f315e8b
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
390 call feedkeys("/the\<c-g>\<c-g>\<cr>", 'tx') |
42cd1f315e8b
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
391 call assert_equal(' 3 the third', getline('.')) |
42cd1f315e8b
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
392 $ |
42cd1f315e8b
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
393 call feedkeys("?the\<c-t>\<c-t>\<c-t>\<cr>", 'tx') |
42cd1f315e8b
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
394 call assert_equal(' 2 the second', getline('.')) |
42cd1f315e8b
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
395 " clean up |
42cd1f315e8b
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
396 set noincsearch |
42cd1f315e8b
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
397 bw! |
42cd1f315e8b
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
398 endfunc |
42cd1f315e8b
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
399 |
12744
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
400 func Test_search_cmdline6() |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
401 " Test that consecutive matches |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
402 " are caught by <c-g>/<c-t> |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
403 if !exists('+incsearch') |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
404 return |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
405 endif |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
406 " need to disable char_avail, |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
407 " so that expansion of commandline works |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
408 call test_override("char_avail", 1) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
409 new |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
410 call setline(1, [' bbvimb', '']) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
411 set incsearch |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
412 " first match |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
413 norm! gg0 |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
414 call feedkeys("/b\<cr>", 'tx') |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
415 call assert_equal([0,1,2,0], getpos('.')) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
416 " second match |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
417 norm! gg0 |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
418 call feedkeys("/b\<c-g>\<cr>", 'tx') |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
419 call assert_equal([0,1,3,0], getpos('.')) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
420 " third match |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
421 norm! gg0 |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
422 call feedkeys("/b\<c-g>\<c-g>\<cr>", 'tx') |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
423 call assert_equal([0,1,7,0], getpos('.')) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
424 " first match again |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
425 norm! gg0 |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
426 call feedkeys("/b\<c-g>\<c-g>\<c-g>\<cr>", 'tx') |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
427 call assert_equal([0,1,2,0], getpos('.')) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
428 set nowrapscan |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
429 " last match |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
430 norm! gg0 |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
431 call feedkeys("/b\<c-g>\<c-g>\<c-g>\<cr>", 'tx') |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
432 call assert_equal([0,1,7,0], getpos('.')) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
433 " clean up |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
434 set wrapscan&vim |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
435 set noincsearch |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
436 call test_override("char_avail", 0) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
437 bw! |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
438 endfunc |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
439 |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
440 func Test_search_cmdline7() |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
441 " Test that an pressing <c-g> in an empty command line |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
442 " does not move the cursor |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
443 if !exists('+incsearch') |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
444 return |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
445 endif |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
446 " need to disable char_avail, |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
447 " so that expansion of commandline works |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
448 call test_override("char_avail", 1) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
449 new |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
450 let @/='b' |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
451 call setline(1, [' bbvimb', '']) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
452 set incsearch |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
453 " first match |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
454 norm! gg0 |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
455 " moves to next match of previous search pattern, just like /<cr> |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
456 call feedkeys("/\<c-g>\<cr>", 'tx') |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
457 call assert_equal([0,1,2,0], getpos('.')) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
458 " moves to next match of previous search pattern, just like /<cr> |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
459 call feedkeys("/\<cr>", 'tx') |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
460 call assert_equal([0,1,3,0], getpos('.')) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
461 " moves to next match of previous search pattern, just like /<cr> |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
462 call feedkeys("/\<c-t>\<cr>", 'tx') |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
463 call assert_equal([0,1,7,0], getpos('.')) |
12855
3c09e451af3a
patch 8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
464 |
3c09e451af3a
patch 8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
465 " using an offset uses the last search pattern |
3c09e451af3a
patch 8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
466 call cursor(1, 1) |
3c09e451af3a
patch 8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
467 call setline(1, ['1 bbvimb', ' 2 bbvimb']) |
3c09e451af3a
patch 8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
468 let @/ = 'b' |
3c09e451af3a
patch 8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
469 call feedkeys("//e\<c-g>\<cr>", 'tx') |
3c09e451af3a
patch 8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
470 call assert_equal('1 bbvimb', getline('.')) |
3c09e451af3a
patch 8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
471 call assert_equal(4, col('.')) |
3c09e451af3a
patch 8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
472 |
12744
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
473 set noincsearch |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
474 call test_override("char_avail", 0) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
475 bw! |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
476 endfunc |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
477 |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
478 func Test_search_cmdline8() |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
479 " Highlighting is cleared in all windows |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
480 " since hls applies to all windows |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
481 if !exists('+incsearch') || !has('terminal') || has('gui_running') || winwidth(0) < 30 |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
482 return |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
483 endif |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
484 if has("win32") |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
485 throw "Skipped: Bug with sending <ESC> to terminal window not fixed yet" |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
486 endif |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
487 let h = winheight(0) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
488 if h < 3 |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
489 return |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
490 endif |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
491 " Prepare buffer text |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
492 let lines = ['abb vim vim vi', 'vimvivim'] |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
493 call writefile(lines, 'Xsearch.txt') |
12763
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
494 let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', 'Xsearch.txt'], {'term_rows': 3}) |
12744
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
495 |
12763
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
496 call WaitFor({-> lines == [term_getline(buf, 1), term_getline(buf, 2)] }) |
12744
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
497 |
12763
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
498 call term_sendkeys(buf, ":set incsearch hlsearch\<cr>") |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
499 call term_sendkeys(buf, ":14vsp\<cr>") |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
500 call term_sendkeys(buf, "/vim\<cr>") |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
501 call term_sendkeys(buf, "/b\<esc>") |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
502 call term_sendkeys(buf, "gg0") |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
503 call term_wait(buf, 500) |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
504 let screen_line = term_scrape(buf, 1) |
12744
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
505 let [a0,a1,a2,a3] = [screen_line[3].attr, screen_line[4].attr, |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
506 \ screen_line[18].attr, screen_line[19].attr] |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
507 call assert_notequal(a0, a1) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
508 call assert_notequal(a0, a3) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
509 call assert_notequal(a1, a2) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
510 call assert_equal(a0, a2) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
511 call assert_equal(a1, a3) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
512 " clean up |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
513 call delete('Xsearch.txt') |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
514 |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
515 bwipe! |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
516 endfunc |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
517 |
12560
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
518 " Tests for regexp with various magic settings |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
519 func Test_search_regexp() |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
520 enew! |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
521 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
522 put ='1 a aa abb abbccc' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
523 exe 'normal! /a*b\{2}c\+/e' . "\<CR>" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
524 call assert_equal([0, 2, 17, 0], getpos('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
525 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
526 put ='2 d dd dee deefff' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
527 exe 'normal! /\Md\*e\{2}f\+/e' . "\<CR>" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
528 call assert_equal([0, 3, 17, 0], getpos('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
529 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
530 set nomagic |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
531 put ='3 g gg ghh ghhiii' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
532 exe 'normal! /g\*h\{2}i\+/e' . "\<CR>" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
533 call assert_equal([0, 4, 17, 0], getpos('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
534 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
535 put ='4 j jj jkk jkklll' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
536 exe 'normal! /\mj*k\{2}l\+/e' . "\<CR>" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
537 call assert_equal([0, 5, 17, 0], getpos('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
538 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
539 put ='5 m mm mnn mnnooo' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
540 exe 'normal! /\vm*n{2}o+/e' . "\<CR>" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
541 call assert_equal([0, 6, 17, 0], getpos('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
542 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
543 put ='6 x ^aa$ x' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
544 exe 'normal! /\V^aa$' . "\<CR>" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
545 call assert_equal([0, 7, 5, 0], getpos('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
546 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
547 set magic |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
548 put ='7 (a)(b) abbaa' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
549 exe 'normal! /\v(a)(b)\2\1\1/e' . "\<CR>" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
550 call assert_equal([0, 8, 14, 0], getpos('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
551 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
552 put ='8 axx [ab]xx' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
553 exe 'normal! /\V[ab]\(\[xy]\)\1' . "\<CR>" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
554 call assert_equal([0, 9, 7, 0], getpos('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
555 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
556 set undolevels=100 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
557 put ='9 foobar' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
558 put ='' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
559 exe "normal! a\<C-G>u\<Esc>" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
560 normal G |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
561 exe 'normal! dv?bar?' . "\<CR>" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
562 call assert_equal('9 foo', getline('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
563 call assert_equal([0, 10, 5, 0], getpos('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
564 call assert_equal(10, line('$')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
565 normal u |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
566 call assert_equal('9 foobar', getline('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
567 call assert_equal([0, 10, 6, 0], getpos('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
568 call assert_equal(11, line('$')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
569 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
570 set undolevels& |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
571 enew! |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
572 endfunc |
12720
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
573 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
574 func Test_search_cmdline_incsearch_highlight() |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
575 if !exists('+incsearch') |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
576 return |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
577 endif |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
578 set incsearch hlsearch |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
579 " need to disable char_avail, |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
580 " so that expansion of commandline works |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
581 call test_override("char_avail", 1) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
582 new |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
583 call setline(1, ['aaa 1 the first', ' 2 the second', ' 3 the third']) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
584 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
585 1 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
586 call feedkeys("/second\<cr>", 'tx') |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
587 call assert_equal('second', @/) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
588 call assert_equal(' 2 the second', getline('.')) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
589 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
590 " Canceling search won't change @/ |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
591 1 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
592 let @/ = 'last pattern' |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
593 call feedkeys("/third\<C-c>", 'tx') |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
594 call assert_equal('last pattern', @/) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
595 call feedkeys("/third\<Esc>", 'tx') |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
596 call assert_equal('last pattern', @/) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
597 call feedkeys("/3\<bs>\<bs>", 'tx') |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
598 call assert_equal('last pattern', @/) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
599 call feedkeys("/third\<c-g>\<c-t>\<Esc>", 'tx') |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
600 call assert_equal('last pattern', @/) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
601 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
602 " clean up |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
603 set noincsearch nohlsearch |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
604 bw! |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
605 endfunc |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
606 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
607 func Test_search_cmdline_incsearch_highlight_attr() |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
608 if !exists('+incsearch') || !has('terminal') || has('gui_running') |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
609 return |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
610 endif |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
611 let h = winheight(0) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
612 if h < 3 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
613 return |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
614 endif |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
615 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
616 " Prepare buffer text |
12763
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
617 let lines = ['abb vim vim vi', 'vimvivim'] |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
618 call writefile(lines, 'Xsearch.txt') |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
619 let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', 'Xsearch.txt'], {'term_rows': 3}) |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
620 |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
621 call WaitFor({-> lines == [term_getline(buf, 1), term_getline(buf, 2)] }) |
13132
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13084
diff
changeset
|
622 " wait for vim to complete initialization |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13084
diff
changeset
|
623 call term_wait(buf) |
12720
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
624 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
625 " Get attr of normal(a0), incsearch(a1), hlsearch(a2) highlight |
12763
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
626 call term_sendkeys(buf, ":set incsearch hlsearch\<cr>") |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
627 call term_sendkeys(buf, '/b') |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
628 call term_wait(buf, 200) |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
629 let screen_line1 = term_scrape(buf, 1) |
12720
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
630 call assert_true(len(screen_line1) > 2) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
631 " a0: attr_normal |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
632 let a0 = screen_line1[0].attr |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
633 " a1: attr_incsearch |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
634 let a1 = screen_line1[1].attr |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
635 " a2: attr_hlsearch |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
636 let a2 = screen_line1[2].attr |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
637 call assert_notequal(a0, a1) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
638 call assert_notequal(a0, a2) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
639 call assert_notequal(a1, a2) |
12763
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
640 call term_sendkeys(buf, "\<cr>gg0") |
12720
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
641 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
642 " Test incremental highlight search |
12763
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
643 call term_sendkeys(buf, "/vim") |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
644 call term_wait(buf, 200) |
12720
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
645 " Buffer: |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
646 " abb vim vim vi |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
647 " vimvivim |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
648 " Search: /vim |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
649 let attr_line1 = [a0,a0,a0,a0,a1,a1,a1,a0,a2,a2,a2,a0,a0,a0] |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
650 let attr_line2 = [a2,a2,a2,a0,a0,a2,a2,a2] |
12763
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
651 call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr')) |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
652 call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr')) |
12720
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
653 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
654 " Test <C-g> |
12763
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
655 call term_sendkeys(buf, "\<C-g>\<C-g>") |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
656 call term_wait(buf, 200) |
12720
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
657 let attr_line1 = [a0,a0,a0,a0,a2,a2,a2,a0,a2,a2,a2,a0,a0,a0] |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
658 let attr_line2 = [a1,a1,a1,a0,a0,a2,a2,a2] |
12763
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
659 call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr')) |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
660 call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr')) |
12720
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
661 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
662 " Test <C-t> |
12763
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
663 call term_sendkeys(buf, "\<C-t>") |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
664 call term_wait(buf, 200) |
12720
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
665 let attr_line1 = [a0,a0,a0,a0,a2,a2,a2,a0,a1,a1,a1,a0,a0,a0] |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
666 let attr_line2 = [a2,a2,a2,a0,a0,a2,a2,a2] |
12763
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
667 call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr')) |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
668 call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr')) |
12720
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
669 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
670 " Type Enter and a1(incsearch highlight) should become a2(hlsearch highlight) |
12763
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
671 call term_sendkeys(buf, "\<cr>") |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
672 call term_wait(buf, 200) |
12720
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
673 let attr_line1 = [a0,a0,a0,a0,a2,a2,a2,a0,a2,a2,a2,a0,a0,a0] |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
674 let attr_line2 = [a2,a2,a2,a0,a0,a2,a2,a2] |
12763
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
675 call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr')) |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
676 call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr')) |
12720
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
677 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
678 " Test nohlsearch. a2(hlsearch highlight) should become a0(normal highlight) |
12763
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
679 call term_sendkeys(buf, ":1\<cr>") |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
680 call term_sendkeys(buf, ":set nohlsearch\<cr>") |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
681 call term_sendkeys(buf, "/vim") |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
682 call term_wait(buf, 200) |
12720
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
683 let attr_line1 = [a0,a0,a0,a0,a1,a1,a1,a0,a0,a0,a0,a0,a0,a0] |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
684 let attr_line2 = [a0,a0,a0,a0,a0,a0,a0,a0] |
12763
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
685 call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr')) |
7f27e9769f62
patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents:
12759
diff
changeset
|
686 call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr')) |
12744
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
687 call delete('Xsearch.txt') |
12720
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
688 |
12732
75abce3e933d
patch 8.0.1244: search test does not work correctly on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12730
diff
changeset
|
689 call delete('Xsearch.txt') |
12720
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
690 bwipe! |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
691 endfunc |
12730
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
692 |
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
693 func Test_search_undefined_behaviour() |
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
694 if !has("terminal") |
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
695 return |
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
696 endif |
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
697 let h = winheight(0) |
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
698 if h < 3 |
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
699 return |
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
700 endif |
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
701 " did cause an undefined left shift |
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
702 let g:buf = term_start([GetVimProg(), '--clean', '-e', '-s', '-c', 'call search(getline("."))', 'samples/test000'], {'term_rows': 3}) |
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
703 call assert_equal([''], getline(1, '$')) |
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
704 call term_sendkeys(g:buf, ":qa!\<cr>") |
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
705 bwipe! |
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
706 endfunc |
12759
528b227051f8
patch 8.0.1257: no test for fix of undefined behavior
Christian Brabandt <cb@256bit.org>
parents:
12744
diff
changeset
|
707 |
528b227051f8
patch 8.0.1257: no test for fix of undefined behavior
Christian Brabandt <cb@256bit.org>
parents:
12744
diff
changeset
|
708 func Test_search_undefined_behaviour2() |
528b227051f8
patch 8.0.1257: no test for fix of undefined behavior
Christian Brabandt <cb@256bit.org>
parents:
12744
diff
changeset
|
709 call search("\%UC0000000") |
528b227051f8
patch 8.0.1257: no test for fix of undefined behavior
Christian Brabandt <cb@256bit.org>
parents:
12744
diff
changeset
|
710 endfunc |
12788
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12763
diff
changeset
|
711 |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12763
diff
changeset
|
712 " Test for search('multi-byte char', 'bce') |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12763
diff
changeset
|
713 func Test_search_multibyte() |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12763
diff
changeset
|
714 if !has('multi_byte') |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12763
diff
changeset
|
715 return |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12763
diff
changeset
|
716 endif |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12763
diff
changeset
|
717 let save_enc = &encoding |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12763
diff
changeset
|
718 set encoding=utf8 |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12763
diff
changeset
|
719 enew! |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12763
diff
changeset
|
720 call append('$', 'A') |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12763
diff
changeset
|
721 call cursor(2, 1) |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12763
diff
changeset
|
722 call assert_equal(2, search('A', 'bce', line('.'))) |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12763
diff
changeset
|
723 enew! |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12763
diff
changeset
|
724 let &encoding = save_enc |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12763
diff
changeset
|
725 endfunc |
13043
307f2622826f
patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents:
12855
diff
changeset
|
726 |
307f2622826f
patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents:
12855
diff
changeset
|
727 " This was causing E874. Also causes an invalid read? |
307f2622826f
patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents:
12855
diff
changeset
|
728 func Test_look_behind() |
307f2622826f
patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents:
12855
diff
changeset
|
729 new |
307f2622826f
patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents:
12855
diff
changeset
|
730 call setline(1, '0\|\&\n\@<=') |
307f2622826f
patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents:
12855
diff
changeset
|
731 call search(getline(".")) |
307f2622826f
patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents:
12855
diff
changeset
|
732 bwipe! |
307f2622826f
patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents:
12855
diff
changeset
|
733 endfunc |
13082
a80082fd1a1d
patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents:
13043
diff
changeset
|
734 |
a80082fd1a1d
patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents:
13043
diff
changeset
|
735 func Test_search_sentence() |
a80082fd1a1d
patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents:
13043
diff
changeset
|
736 new |
a80082fd1a1d
patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents:
13043
diff
changeset
|
737 " this used to cause a crash |
13084
25ab78f14c8b
patch 8.0.1417: test doesn't search for a sentence
Christian Brabandt <cb@256bit.org>
parents:
13082
diff
changeset
|
738 call assert_fails("/\\%')", 'E486') |
13082
a80082fd1a1d
patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents:
13043
diff
changeset
|
739 call assert_fails("/", 'E486') |
13084
25ab78f14c8b
patch 8.0.1417: test doesn't search for a sentence
Christian Brabandt <cb@256bit.org>
parents:
13082
diff
changeset
|
740 /\%'( |
25ab78f14c8b
patch 8.0.1417: test doesn't search for a sentence
Christian Brabandt <cb@256bit.org>
parents:
13082
diff
changeset
|
741 / |
13082
a80082fd1a1d
patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents:
13043
diff
changeset
|
742 endfunc |