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