Mercurial > vim
annotate src/testdir/test_search.vim @ 12744:0c704288ced4 v8.0.1250
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
commit https://github.com/vim/vim/commit/f8f8b2eadbaf3090fcfccbab560de5dbd501833d
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Nov 2 19:08:48 2017 +0100
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Problem: 'hlsearch' highlighting not removed after incsearch (lacygoill)
Solution: Redraw all windows. Start search at the end of the match. Improve
how CTRL-G works with incremental search. Add tests. (Christian
Brabandt, Hirohito Higashi, haya14busa, closes #2267)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 02 Nov 2017 19:15:05 +0100 |
parents | 75abce3e933d |
children | 528b227051f8 |
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('.')) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
464 set noincsearch |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
465 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
|
466 bw! |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
467 endfunc |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
468 |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
469 func Test_search_cmdline8() |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
470 " 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
|
471 " 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
|
472 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
|
473 return |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
474 endif |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
475 if has("win32") |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
476 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
|
477 endif |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
478 let h = winheight(0) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
479 if h < 3 |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
480 return |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
481 endif |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
482 " Prepare buffer text |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
483 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
|
484 call writefile(lines, 'Xsearch.txt') |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
485 let g:buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', 'Xsearch.txt'], {'term_rows': 3}) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
486 |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
487 call term_wait(g:buf, 200) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
488 call assert_equal(lines[0], term_getline(g:buf, 1)) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
489 call assert_equal(lines[1], term_getline(g:buf, 2)) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
490 |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
491 call term_sendkeys(g:buf, ":set incsearch hlsearch\<cr>") |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
492 call term_sendkeys(g:buf, ":14vsp\<cr>") |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
493 call term_sendkeys(g:buf, "/vim\<cr>") |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
494 call term_sendkeys(g:buf, "/b\<esc>") |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
495 call term_sendkeys(g:buf, "gg0") |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
496 call term_wait(g:buf, 500) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
497 let screen_line = term_scrape(g:buf, 1) |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
498 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
|
499 \ 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
|
500 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
|
501 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
|
502 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
|
503 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
|
504 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
|
505 " clean up |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
506 call delete('Xsearch.txt') |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
507 |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
508 bwipe! |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
509 endfunc |
0c704288ced4
patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents:
12732
diff
changeset
|
510 |
12560
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
511 " 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
|
512 func Test_search_regexp() |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
513 enew! |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
514 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
515 put ='1 a aa abb abbccc' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
516 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
|
517 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
|
518 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
519 put ='2 d dd dee deefff' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
520 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
|
521 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
|
522 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
523 set nomagic |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
524 put ='3 g gg ghh ghhiii' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
525 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
|
526 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
|
527 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
528 put ='4 j jj jkk jkklll' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
529 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
|
530 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
|
531 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
532 put ='5 m mm mnn mnnooo' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
533 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
|
534 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
|
535 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
536 put ='6 x ^aa$ x' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
537 exe 'normal! /\V^aa$' . "\<CR>" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
538 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
|
539 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
540 set magic |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
541 put ='7 (a)(b) abbaa' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
542 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
|
543 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
|
544 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
545 put ='8 axx [ab]xx' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
546 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
|
547 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
|
548 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
549 set undolevels=100 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
550 put ='9 foobar' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
551 put ='' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
552 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
|
553 normal G |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
554 exe 'normal! dv?bar?' . "\<CR>" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
555 call assert_equal('9 foo', getline('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
556 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
|
557 call assert_equal(10, line('$')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
558 normal u |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
559 call assert_equal('9 foobar', getline('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
560 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
|
561 call assert_equal(11, line('$')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
562 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
563 set undolevels& |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
564 enew! |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11619
diff
changeset
|
565 endfunc |
12720
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
566 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
567 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
|
568 if !exists('+incsearch') |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
569 return |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
570 endif |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
571 set incsearch hlsearch |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
572 " 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
|
573 " 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
|
574 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
|
575 new |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
576 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
|
577 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
578 1 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
579 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
|
580 call assert_equal('second', @/) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
581 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
|
582 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
583 " 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
|
584 1 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
585 let @/ = 'last pattern' |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
586 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
|
587 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
|
588 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
|
589 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
|
590 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
|
591 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
|
592 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
|
593 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
|
594 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
595 " clean up |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
596 set noincsearch nohlsearch |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
597 bw! |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
598 endfunc |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
599 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
600 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
|
601 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
|
602 return |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
603 endif |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
604 let h = winheight(0) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
605 if h < 3 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
606 return |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
607 endif |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
608 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
609 " Prepare buffer text |
12732
75abce3e933d
patch 8.0.1244: search test does not work correctly on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12730
diff
changeset
|
610 let g:lines = ['abb vim vim vi', 'vimvivim'] |
75abce3e933d
patch 8.0.1244: search test does not work correctly on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12730
diff
changeset
|
611 call writefile(g:lines, 'Xsearch.txt') |
75abce3e933d
patch 8.0.1244: search test does not work correctly on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12730
diff
changeset
|
612 let g:buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', 'Xsearch.txt'], {'term_rows': 3}) |
75abce3e933d
patch 8.0.1244: search test does not work correctly on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12730
diff
changeset
|
613 call WaitFor('g:lines[0] == term_getline(g:buf, 1)') |
75abce3e933d
patch 8.0.1244: search test does not work correctly on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12730
diff
changeset
|
614 call assert_equal(g:lines[0], term_getline(g:buf, 1)) |
75abce3e933d
patch 8.0.1244: search test does not work correctly on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12730
diff
changeset
|
615 call assert_equal(g:lines[1], term_getline(g:buf, 2)) |
75abce3e933d
patch 8.0.1244: search test does not work correctly on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12730
diff
changeset
|
616 unlet g:lines |
12720
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
617 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
618 " Get attr of normal(a0), incsearch(a1), hlsearch(a2) highlight |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
619 call term_sendkeys(g:buf, ":set incsearch hlsearch\<cr>") |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
620 call term_sendkeys(g:buf, '/b') |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
621 call term_wait(g:buf, 200) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
622 let screen_line1 = term_scrape(g:buf, 1) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
623 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
|
624 " a0: attr_normal |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
625 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
|
626 " a1: attr_incsearch |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
627 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
|
628 " a2: attr_hlsearch |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
629 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
|
630 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
|
631 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
|
632 call assert_notequal(a1, a2) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
633 call term_sendkeys(g:buf, "\<cr>gg0") |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
634 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
635 " Test incremental highlight search |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
636 call term_sendkeys(g:buf, "/vim") |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
637 call term_wait(g:buf, 200) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
638 " Buffer: |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
639 " abb vim vim vi |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
640 " vimvivim |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
641 " Search: /vim |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
642 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
|
643 let attr_line2 = [a2,a2,a2,a0,a0,a2,a2,a2] |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
644 call assert_equal(attr_line1, map(term_scrape(g:buf, 1)[:len(attr_line1)-1], 'v:val.attr')) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
645 call assert_equal(attr_line2, map(term_scrape(g:buf, 2)[:len(attr_line2)-1], 'v:val.attr')) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
646 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
647 " Test <C-g> |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
648 call term_sendkeys(g:buf, "\<C-g>\<C-g>") |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
649 call term_wait(g:buf, 200) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
650 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
|
651 let attr_line2 = [a1,a1,a1,a0,a0,a2,a2,a2] |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
652 call assert_equal(attr_line1, map(term_scrape(g:buf, 1)[:len(attr_line1)-1], 'v:val.attr')) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
653 call assert_equal(attr_line2, map(term_scrape(g:buf, 2)[:len(attr_line2)-1], 'v:val.attr')) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
654 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
655 " Test <C-t> |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
656 call term_sendkeys(g:buf, "\<C-t>") |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
657 call term_wait(g:buf, 200) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
658 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
|
659 let attr_line2 = [a2,a2,a2,a0,a0,a2,a2,a2] |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
660 call assert_equal(attr_line1, map(term_scrape(g:buf, 1)[:len(attr_line1)-1], 'v:val.attr')) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
661 call assert_equal(attr_line2, map(term_scrape(g:buf, 2)[:len(attr_line2)-1], 'v:val.attr')) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
662 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
663 " Type Enter and a1(incsearch highlight) should become a2(hlsearch highlight) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
664 call term_sendkeys(g:buf, "\<cr>") |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
665 call term_wait(g:buf, 200) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
666 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
|
667 let attr_line2 = [a2,a2,a2,a0,a0,a2,a2,a2] |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
668 call assert_equal(attr_line1, map(term_scrape(g:buf, 1)[:len(attr_line1)-1], 'v:val.attr')) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
669 call assert_equal(attr_line2, map(term_scrape(g:buf, 2)[:len(attr_line2)-1], 'v:val.attr')) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
670 |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
671 " Test nohlsearch. a2(hlsearch highlight) should become a0(normal highlight) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
672 call term_sendkeys(g:buf, ":1\<cr>") |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
673 call term_sendkeys(g:buf, ":set nohlsearch\<cr>") |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
674 call term_sendkeys(g:buf, "/vim") |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
675 call term_wait(g:buf, 200) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
676 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
|
677 let attr_line2 = [a0,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
|
678 call assert_equal(attr_line1, map(term_scrape(g:buf, 1)[:len(attr_line1)-1], 'v:val.attr')) |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
679 call assert_equal(attr_line2, map(term_scrape(g: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
|
680 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
|
681 |
12732
75abce3e933d
patch 8.0.1244: search test does not work correctly on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12730
diff
changeset
|
682 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
|
683 bwipe! |
37c384802df4
patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents:
12664
diff
changeset
|
684 endfunc |
12730
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
685 |
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
686 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
|
687 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
|
688 return |
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
689 endif |
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
690 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
|
691 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
|
692 return |
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
693 endif |
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
694 " 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
|
695 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
|
696 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
|
697 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
|
698 bwipe! |
6fa9f6b4d159
patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents:
12722
diff
changeset
|
699 endfunc |