annotate src/testdir/test_search.vim @ 13808:16a062cf08c2 v8.0.1776

patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why commit https://github.com/vim/vim/commit/0e9d1ae3216a5940b36bb56d155fb300b2e55b00 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Apr 30 14:28:24 2018 +0200 patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why Problem: In tests, when WaitFor() fails it doesn't say why. Solution: Turn a few more WaitFor() into WaitForAssert().
author Christian Brabandt <cb@256bit.org>
date Mon, 30 Apr 2018 14:30:07 +0200
parents dd6a63e3e7c4
children 0181a2cad0a1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
1435e45ee6fa commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents: 10172
diff changeset
290 let a=searchpair('\[','',']','bW')
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
1435e45ee6fa commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents: 10172
diff changeset
294 let a=searchpair('\[','',']','bW')
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
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
300 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
301 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
302 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
303 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
304 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
305 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
306 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
307 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
308 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
309 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
310 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', '0'))
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
311 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', {-> 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
312 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
313 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
314 " invalid argument
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
315 3 | call assert_equal(0, searchpair('{', '', '}', 'bWn', 0))
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
316 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
317 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
318
11018
654fc5636b37 patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents: 10514
diff changeset
319 func Test_searchc()
654fc5636b37 patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents: 10514
diff changeset
320 " 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
321 new
654fc5636b37 patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents: 10514
diff changeset
322 norm ixx
654fc5636b37 patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents: 10514
diff changeset
323 exe "norm 0t\u93cf"
654fc5636b37 patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents: 10514
diff changeset
324 bw!
654fc5636b37 patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents: 10514
diff changeset
325 endfunc
11613
7428a08c2f68 patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents: 11105
diff changeset
326
7428a08c2f68 patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents: 11105
diff changeset
327 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
328 if !exists('+incsearch')
7428a08c2f68 patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents: 11105
diff changeset
329 return
7428a08c2f68 patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents: 11105
diff changeset
330 endif
7428a08c2f68 patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents: 11105
diff changeset
331 " 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
332 " 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
333 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
334 new
7428a08c2f68 patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents: 11105
diff changeset
335 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
336 set incsearch
7428a08c2f68 patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents: 11105
diff changeset
337 1
7428a08c2f68 patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents: 11105
diff changeset
338 " first match
7428a08c2f68 patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents: 11105
diff changeset
339 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
340 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
341 " clean up
7428a08c2f68 patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents: 11105
diff changeset
342 set noincsearch
7428a08c2f68 patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents: 11105
diff changeset
343 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
344 bw!
7428a08c2f68 patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents: 11105
diff changeset
345 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
346
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
347 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
348 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
349 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
350 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
351 " 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
352 " 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
353 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
354 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
355 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
356 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
357 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
358 call 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
359 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
360 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
361 call 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
362 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
363 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
364 call 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
365 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
366 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
367 call 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
368 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
369 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
370 call 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
371 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
372 $
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 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
374 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
375 " 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
376 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
377 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
378 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
379 endfunc
12560
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
380
12664
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
381 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
382 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
383 return
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
384 endif
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
385 " 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
386 " 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
387 new
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
388 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
389 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
390 1
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
391 call 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
392 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
393 $
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
394 call 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
395 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
396 " 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
397 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
398 bw!
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
399 endfunc
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
400
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
401 func Test_search_cmdline6()
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
402 " Test that consecutive matches
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
403 " 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
404 if !exists('+incsearch')
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
405 return
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
406 endif
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
407 " 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
408 " 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
409 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
410 new
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
411 call setline(1, [' bbvimb', ''])
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
412 set incsearch
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
413 " first match
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
414 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
415 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
416 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
417 " second match
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
418 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
419 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
420 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
421 " third match
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
422 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
423 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
424 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
425 " first match again
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
426 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
427 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
428 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
429 set nowrapscan
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
430 " last match
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
431 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
432 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
433 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
434 " clean up
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
435 set wrapscan&vim
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
436 set noincsearch
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
437 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
438 bw!
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
439 endfunc
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
440
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
441 func Test_search_cmdline7()
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
442 " 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
443 " 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
444 if !exists('+incsearch')
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
445 return
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
446 endif
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
447 " 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
448 " 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
449 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
450 new
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
451 let @/='b'
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
452 call setline(1, [' bbvimb', ''])
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
453 set incsearch
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
454 " first match
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
455 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
456 " 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
457 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
458 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
459 " 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
460 call feedkeys("/\<cr>", 'tx')
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
461 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
462 " 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
463 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
464 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
465
3c09e451af3a patch 8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
466 " 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
467 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
468 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
469 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
470 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
471 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
472 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
473
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
474 set noincsearch
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
475 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
476 bw!
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
477 endfunc
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
478
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
479 func Test_search_cmdline8()
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
480 " 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
481 " 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
482 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
483 return
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
484 endif
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
485 if has("win32")
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
486 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
487 endif
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
488 let h = winheight(0)
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
489 if h < 3
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
490 return
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
491 endif
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
492 " Prepare buffer text
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
493 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
494 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
495 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
496
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
497 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
498
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
499 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
500 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
501 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
502 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
503 call term_sendkeys(buf, "gg0")
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
504 call term_wait(buf, 500)
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
505 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
506 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
507 \ 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
508 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
509 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
510 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
511 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
512 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
513 " clean up
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
514 call delete('Xsearch.txt')
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
515
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
516 bwipe!
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
517 endfunc
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
518
12560
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
519 " 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
520 func Test_search_regexp()
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
521 enew!
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
522
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
523 put ='1 a aa abb abbccc'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
524 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
525 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
526
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
527 put ='2 d dd dee deefff'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
528 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
529 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
530
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
531 set nomagic
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
532 put ='3 g gg ghh ghhiii'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
533 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
534 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
535
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
536 put ='4 j jj jkk jkklll'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
537 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
538 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
539
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
540 put ='5 m mm mnn mnnooo'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
541 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
542 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
543
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
544 put ='6 x ^aa$ x'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
545 exe 'normal! /\V^aa$' . "\<CR>"
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
546 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
547
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
548 set magic
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
549 put ='7 (a)(b) abbaa'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
550 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
551 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
552
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
553 put ='8 axx [ab]xx'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
554 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
555 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
556
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
557 set undolevels=100
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
558 put ='9 foobar'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
559 put =''
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
560 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
561 normal G
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
562 exe 'normal! dv?bar?' . "\<CR>"
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
563 call assert_equal('9 foo', getline('.'))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
564 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
565 call assert_equal(10, line('$'))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
566 normal u
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
567 call assert_equal('9 foobar', getline('.'))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
568 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
569 call assert_equal(11, line('$'))
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 set undolevels&
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
572 enew!
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
573 endfunc
12720
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
574
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
575 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
576 if !exists('+incsearch')
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
577 return
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
578 endif
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
579 set incsearch hlsearch
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
580 " 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
581 " 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
582 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
583 new
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
584 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
585
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
586 1
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
587 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
588 call assert_equal('second', @/)
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
589 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
590
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
591 " 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
592 1
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
593 let @/ = 'last pattern'
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
594 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
595 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
596 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
597 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
598 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
599 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
600 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
601 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
602
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
603 " clean up
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
604 set noincsearch nohlsearch
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
605 bw!
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
606 endfunc
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
607
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
608 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
609 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
610 return
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
611 endif
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
612 let h = winheight(0)
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
613 if h < 3
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
614 return
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
615 endif
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
616
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
617 " Prepare buffer text
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
618 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
619 call writefile(lines, 'Xsearch.txt')
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
620 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
621
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
622 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
623 " 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
624 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
625
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
626 " 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
627 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
628 call term_sendkeys(buf, '/b')
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
629 call term_wait(buf, 200)
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
630 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
631 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
632 " a0: attr_normal
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
633 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
634 " a1: attr_incsearch
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
635 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
636 " a2: attr_hlsearch
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
637 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
638 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
639 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
640 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
641 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
642
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
643 " Test incremental highlight search
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
644 call term_sendkeys(buf, "/vim")
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
645 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
646 " Buffer:
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
647 " abb vim vim vi
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
648 " vimvivim
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
649 " Search: /vim
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
650 let attr_line1 = [a0,a0,a0,a0,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
651 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
652 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
653 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
654
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
655 " Test <C-g>
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
656 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
657 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
658 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
659 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
660 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
661 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
662
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
663 " Test <C-t>
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
664 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
665 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
666 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
667 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
668 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
669 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
670
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
671 " 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
672 call term_sendkeys(buf, "\<cr>")
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
673 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
674 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
675 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
676 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
677 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
678
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
679 " 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
680 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
681 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
682 call term_sendkeys(buf, "/vim")
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,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
685 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
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'))
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
688 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
689
12732
75abce3e933d patch 8.0.1244: search test does not work correctly on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 12730
diff changeset
690 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
691 bwipe!
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
692 endfunc
12730
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
693
13790
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
694 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
695 if !CanRunVimInTerminal()
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
696 return
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
697 endif
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
698 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
699 call writefile([
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
700 \ '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
701 \ '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
702 \ '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
703 \ 'normal gg',
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
704 \ 'redraw',
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
705 \ ], 'Xscript')
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
706 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
707 " 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
708 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
709 sleep 100m
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
710 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
711 sleep 100m
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
712 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
713 sleep 100m
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
714 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
715 sleep 100m
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
716 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
717 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
718
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
719 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
720 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
721 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
722 endfunc
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
723
12730
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
724 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
725 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
726 return
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
727 endif
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
728 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
729 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
730 return
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
731 endif
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
732 " 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
733 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
734 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
735 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
736 bwipe!
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
737 endfunc
12759
528b227051f8 patch 8.0.1257: no test for fix of undefined behavior
Christian Brabandt <cb@256bit.org>
parents: 12744
diff changeset
738
528b227051f8 patch 8.0.1257: no test for fix of undefined behavior
Christian Brabandt <cb@256bit.org>
parents: 12744
diff changeset
739 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
740 call search("\%UC0000000")
528b227051f8 patch 8.0.1257: no test for fix of undefined behavior
Christian Brabandt <cb@256bit.org>
parents: 12744
diff changeset
741 endfunc
12788
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
742
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
743 " 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
744 func Test_search_multibyte()
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
745 if !has('multi_byte')
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
746 return
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
747 endif
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
748 let save_enc = &encoding
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
749 set encoding=utf8
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
750 enew!
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
751 call append('$', 'A')
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
752 call cursor(2, 1)
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
753 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
754 enew!
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
755 let &encoding = save_enc
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
756 endfunc
13043
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
757
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
758 " 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
759 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
760 new
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
761 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
762 call search(getline("."))
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
763 bwipe!
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
764 endfunc
13082
a80082fd1a1d patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13043
diff changeset
765
a80082fd1a1d patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13043
diff changeset
766 func Test_search_sentence()
a80082fd1a1d patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13043
diff changeset
767 new
a80082fd1a1d patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13043
diff changeset
768 " 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
769 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
770 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
771 /\%'(
25ab78f14c8b patch 8.0.1417: test doesn't search for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13082
diff changeset
772 /
13082
a80082fd1a1d patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13043
diff changeset
773 endfunc