annotate src/testdir/test_search.vim @ 14528:58ca11610819 v8.1.0277

patch 8.1.0277: 'incsearch' highlighting wrong in a few cases commit https://github.com/vim/vim/commit/c7f08b7ee1c1ff2080d425c2fcdb6907c26fc98e Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 12 17:39:14 2018 +0200 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases Problem: 'incsearch' highlighting wrong in a few cases. Solution: Fix using last search pattern. Restore highlighting when changing command. (issue #3321)
author Christian Brabandt <cb@256bit.org>
date Sun, 12 Aug 2018 17:45:04 +0200
parents 66b9514b5a99
children 60e0022e6e5d
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
14189
0181a2cad0a1 patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
290 let a = searchpair('\[','',']','bW')
10514
1435e45ee6fa commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents: 10172
diff changeset
291 call assert_equal(3, a)
1435e45ee6fa commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents: 10172
diff changeset
292 set nomagic
1435e45ee6fa commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents: 10172
diff changeset
293 4
14189
0181a2cad0a1 patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
294 let a = searchpair('\[','',']','bW')
10514
1435e45ee6fa commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents: 10172
diff changeset
295 call assert_equal(3, a)
1435e45ee6fa commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents: 10172
diff changeset
296 set magic
1435e45ee6fa commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents: 10172
diff changeset
297 q!
1435e45ee6fa commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents: 10172
diff changeset
298 endfunc
1435e45ee6fa commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents: 10172
diff changeset
299
14189
0181a2cad0a1 patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
300 func Test_searchpair_errors()
0181a2cad0a1 patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
301 call assert_fails("call searchpair([0], 'middle', 'end', 'bW', 'skip', 99, 100)", 'E730: using List as a String')
0181a2cad0a1 patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
302 call assert_fails("call searchpair('start', {-> 0}, 'end', 'bW', 'skip', 99, 100)", 'E729: using Funcref as a String')
0181a2cad0a1 patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
303 call assert_fails("call searchpair('start', 'middle', {'one': 1}, 'bW', 'skip', 99, 100)", 'E731: using Dictionary as a String')
0181a2cad0a1 patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
304 call assert_fails("call searchpair('start', 'middle', 'end', 'flags', 'skip', 99, 100)", 'E475: Invalid argument: flags')
0181a2cad0a1 patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
305 call assert_fails("call searchpair('start', 'middle', 'end', 'bW', 0, 99, 100)", 'E475: Invalid argument: 0')
0181a2cad0a1 patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
306 call assert_fails("call searchpair('start', 'middle', 'end', 'bW', 'func', -99, 100)", 'E475: Invalid argument: -99')
0181a2cad0a1 patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
307 call assert_fails("call searchpair('start', 'middle', 'end', 'bW', 'func', 99, -100)", 'E475: Invalid argument: -100')
0181a2cad0a1 patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
308 endfunc
0181a2cad0a1 patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
309
12722
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
310 func Test_searchpair_skip()
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
311 func Zero()
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
312 return 0
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
313 endfunc
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
314 func Partial(x)
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
315 return a:x
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
316 endfunc
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
317 new
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
318 call setline(1, ['{', 'foo', 'foo', 'foo', '}'])
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
319 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', ''))
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
320 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', '0'))
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
321 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', {-> 0}))
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
322 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', function('Zero')))
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
323 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', function('Partial', [0])))
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
324 bw!
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
325 endfunc
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
326
14331
f8280e1bfc84 patch 8.1.0181: memory leak with trailing characters in skip expression
Christian Brabandt <cb@256bit.org>
parents: 14189
diff changeset
327 func Test_searchpair_leak()
f8280e1bfc84 patch 8.1.0181: memory leak with trailing characters in skip expression
Christian Brabandt <cb@256bit.org>
parents: 14189
diff changeset
328 new
f8280e1bfc84 patch 8.1.0181: memory leak with trailing characters in skip expression
Christian Brabandt <cb@256bit.org>
parents: 14189
diff changeset
329 call setline(1, 'if one else another endif')
f8280e1bfc84 patch 8.1.0181: memory leak with trailing characters in skip expression
Christian Brabandt <cb@256bit.org>
parents: 14189
diff changeset
330
f8280e1bfc84 patch 8.1.0181: memory leak with trailing characters in skip expression
Christian Brabandt <cb@256bit.org>
parents: 14189
diff changeset
331 " The error in the skip expression caused memory to leak.
f8280e1bfc84 patch 8.1.0181: memory leak with trailing characters in skip expression
Christian Brabandt <cb@256bit.org>
parents: 14189
diff changeset
332 call assert_fails("call searchpair('\\<if\\>', '\\<else\\>', '\\<endif\\>', '', '\"foo\" 2')", 'E15:')
f8280e1bfc84 patch 8.1.0181: memory leak with trailing characters in skip expression
Christian Brabandt <cb@256bit.org>
parents: 14189
diff changeset
333
f8280e1bfc84 patch 8.1.0181: memory leak with trailing characters in skip expression
Christian Brabandt <cb@256bit.org>
parents: 14189
diff changeset
334 bwipe!
f8280e1bfc84 patch 8.1.0181: memory leak with trailing characters in skip expression
Christian Brabandt <cb@256bit.org>
parents: 14189
diff changeset
335 endfunc
f8280e1bfc84 patch 8.1.0181: memory leak with trailing characters in skip expression
Christian Brabandt <cb@256bit.org>
parents: 14189
diff changeset
336
11018
654fc5636b37 patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents: 10514
diff changeset
337 func Test_searchc()
654fc5636b37 patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents: 10514
diff changeset
338 " These commands used to cause memory overflow in searchc().
654fc5636b37 patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents: 10514
diff changeset
339 new
654fc5636b37 patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents: 10514
diff changeset
340 norm ixx
654fc5636b37 patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents: 10514
diff changeset
341 exe "norm 0t\u93cf"
654fc5636b37 patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents: 10514
diff changeset
342 bw!
654fc5636b37 patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents: 10514
diff changeset
343 endfunc
11613
7428a08c2f68 patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents: 11105
diff changeset
344
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
345 func Cmdline3_prep()
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
346 " need to disable char_avail,
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
347 " so that expansion of commandline works
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
348 call test_override("char_avail", 1)
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
349 new
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
350 call setline(1, [' 1', ' 2 the~e', ' 3 the theother'])
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
351 set incsearch
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
352 endfunc
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
353
14524
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
354 func Incsearch_cleanup()
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
355 set noincsearch
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
356 call test_override("char_avail", 0)
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
357 bw!
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
358 endfunc
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
359
14522
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
360 func Test_search_cmdline3()
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
361 if !exists('+incsearch')
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
362 return
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
363 endif
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
364 call Cmdline3_prep()
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
365 1
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
366 " first match
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
367 call feedkeys("/the\<c-l>\<cr>", 'tx')
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
368 call assert_equal(' 2 the~e', getline('.'))
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
369
14524
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
370 call Incsearch_cleanup()
14522
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
371 endfunc
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
372
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
373 func Test_search_cmdline3s()
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
374 if !exists('+incsearch')
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
375 return
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
376 endif
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
377 call Cmdline3_prep()
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
378 1
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
379 call feedkeys(":%s/the\<c-l>/xxx\<cr>", 'tx')
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
380 call assert_equal(' 2 xxxe', getline('.'))
14522
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
381 undo
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
382 call feedkeys(":%subs/the\<c-l>/xxx\<cr>", 'tx')
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
383 call assert_equal(' 2 xxxe', getline('.'))
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
384 undo
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
385 call feedkeys(":%substitute/the\<c-l>/xxx\<cr>", 'tx')
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
386 call assert_equal(' 2 xxxe', getline('.'))
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
387
14524
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
388 call Incsearch_cleanup()
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
389 endfunc
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
390
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
391 func Test_search_cmdline3g()
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
392 if !exists('+incsearch')
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
393 return
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
394 endif
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
395 call Cmdline3_prep()
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
396 1
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
397 call feedkeys(":g/the\<c-l>/d\<cr>", 'tx')
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
398 call assert_equal(' 3 the theother', getline(2))
14522
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
399 undo
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
400 call feedkeys(":global/the\<c-l>/d\<cr>", 'tx')
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
401 call assert_equal(' 3 the theother', getline(2))
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
402
14524
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
403 call Incsearch_cleanup()
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
404 endfunc
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
405
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
406 func Test_search_cmdline3v()
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
407 if !exists('+incsearch')
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
408 return
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
409 endif
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
410 call Cmdline3_prep()
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
411 1
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
412 call feedkeys(":v/the\<c-l>/d\<cr>", 'tx')
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
413 call assert_equal(1, line('$'))
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
414 call assert_equal(' 2 the~e', getline(1))
14522
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
415 undo
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
416 call feedkeys(":vglobal/the\<c-l>/d\<cr>", 'tx')
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
417 call assert_equal(1, line('$'))
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
418 call assert_equal(' 2 the~e', getline(1))
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
419
14524
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
420 call Incsearch_cleanup()
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
421 endfunc
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
422
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
423 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
424 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
425 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
426 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
427 " 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
428 " 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
429 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
430 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
431 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
432 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
433 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
434 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
435 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
436 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
437 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
438 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
439 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
440 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
441 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
442 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
443 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
444 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
445 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
446 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
447 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
448 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
449 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
450 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
451 " 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
452 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
453 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
454 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
455 endfunc
12560
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
456
12664
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
457 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
458 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
459 return
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
460 endif
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
461 " 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
462 " 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
463 new
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
464 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
465 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
466 1
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
467 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
468 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
469 $
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
470 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
471 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
472 " 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
473 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
474 bw!
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
475 endfunc
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
476
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
477 func Test_search_cmdline6()
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
478 " Test that consecutive matches
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
479 " 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
480 if !exists('+incsearch')
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
481 return
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
482 endif
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
483 " 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
484 " 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
485 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
486 new
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
487 call setline(1, [' bbvimb', ''])
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
488 set incsearch
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
489 " first match
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
490 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
491 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
492 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
493 " second match
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
494 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
495 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
496 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
497 " third match
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
498 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
499 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
500 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
501 " first match again
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
502 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
503 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
504 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
505 set nowrapscan
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
506 " last match
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
507 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
508 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
509 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
510 " clean up
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
511 set wrapscan&vim
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
512 set noincsearch
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
513 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
514 bw!
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
515 endfunc
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
516
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
517 func Test_search_cmdline7()
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
518 " 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
519 " 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
520 if !exists('+incsearch')
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
521 return
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
522 endif
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
523 " 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
524 " 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
525 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
526 new
14522
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
527 let @/ = 'b'
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
528 call setline(1, [' bbvimb', ''])
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
529 set incsearch
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
530 " first match
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
531 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
532 " 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
533 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
534 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
535 " 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
536 call feedkeys("/\<cr>", 'tx')
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
537 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
538 " 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
539 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
540 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
541
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
542 " 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
543 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
544 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
545 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
546 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
547 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
548 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
549
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
550 set noincsearch
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
551 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
552 bw!
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
553 endfunc
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
554
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
555 func Test_search_cmdline8()
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
556 " 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
557 " 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
558 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
559 return
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
560 endif
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
561 if has("win32")
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
562 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
563 endif
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
564 let h = winheight(0)
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
565 if h < 3
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
566 return
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
567 endif
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
568 " Prepare buffer text
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
569 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
570 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
571 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
572
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
573 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
574
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
575 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
576 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
577 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
578 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
579 call term_sendkeys(buf, "gg0")
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
580 call term_wait(buf, 500)
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
581 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
582 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
583 \ 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
584 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
585 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
586 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
587 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
588 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
589 " clean up
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
590 call delete('Xsearch.txt')
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
591
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
592 bwipe!
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
593 endfunc
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
594
12560
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
595 " 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
596 func Test_search_regexp()
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
597 enew!
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
598
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
599 put ='1 a aa abb abbccc'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
600 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
601 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
602
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
603 put ='2 d dd dee deefff'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
604 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
605 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
606
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
607 set nomagic
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
608 put ='3 g gg ghh ghhiii'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
609 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
610 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
611
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
612 put ='4 j jj jkk jkklll'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
613 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
614 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
615
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
616 put ='5 m mm mnn mnnooo'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
617 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
618 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
619
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
620 put ='6 x ^aa$ x'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
621 exe 'normal! /\V^aa$' . "\<CR>"
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
622 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
623
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
624 set magic
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
625 put ='7 (a)(b) abbaa'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
626 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
627 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
628
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
629 put ='8 axx [ab]xx'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
630 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
631 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
632
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
633 set undolevels=100
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
634 put ='9 foobar'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
635 put =''
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
636 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
637 normal G
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
638 exe 'normal! dv?bar?' . "\<CR>"
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
639 call assert_equal('9 foo', getline('.'))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
640 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
641 call assert_equal(10, line('$'))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
642 normal u
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
643 call assert_equal('9 foobar', getline('.'))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
644 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
645 call assert_equal(11, line('$'))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
646
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
647 set undolevels&
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
648 enew!
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
649 endfunc
12720
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
650
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
651 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
652 if !exists('+incsearch')
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
653 return
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
654 endif
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
655 set incsearch hlsearch
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
656 " 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
657 " 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
658 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
659 new
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
660 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
661
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
662 1
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
663 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
664 call assert_equal('second', @/)
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
665 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
666
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
667 " 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
668 1
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
669 let @/ = 'last pattern'
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
670 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
671 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
672 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
673 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
674 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
675 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
676 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
677 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
678
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
679 " clean up
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
680 set noincsearch nohlsearch
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
681 bw!
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
682 endfunc
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
683
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
684 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
685 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
686 return
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
687 endif
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
688 let h = winheight(0)
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
689 if h < 3
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
690 return
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
691 endif
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
692
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
693 " Prepare buffer text
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
694 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
695 call writefile(lines, 'Xsearch.txt')
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
696 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
697
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
698 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
699 " 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
700 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
701
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
702 " 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
703 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
704 call term_sendkeys(buf, '/b')
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
705 call term_wait(buf, 200)
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
706 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
707 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
708 " a0: attr_normal
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
709 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
710 " a1: attr_incsearch
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
711 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
712 " a2: attr_hlsearch
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
713 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
714 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
715 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
716 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
717 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
718
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
719 " Test incremental highlight search
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
720 call term_sendkeys(buf, "/vim")
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
721 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
722 " Buffer:
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
723 " abb vim vim vi
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
724 " vimvivim
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
725 " Search: /vim
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
726 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
727 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
728 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
729 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
730
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
731 " Test <C-g>
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
732 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
733 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
734 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
735 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
736 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
737 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
738
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
739 " Test <C-t>
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
740 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
741 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
742 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
743 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
744 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
745 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
746
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
747 " 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
748 call term_sendkeys(buf, "\<cr>")
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
749 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
750 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
751 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
752 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
753 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
754
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
755 " 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
756 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
757 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
758 call term_sendkeys(buf, "/vim")
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
759 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
760 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
761 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
762 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
763 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
764 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
765
12732
75abce3e933d patch 8.0.1244: search test does not work correctly on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 12730
diff changeset
766 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
767 bwipe!
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
768 endfunc
12730
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
769
13790
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
770 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
771 if !CanRunVimInTerminal()
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
772 return
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
773 endif
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
774 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
775 call writefile([
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
776 \ '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
777 \ '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
778 \ '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
779 \ 'normal gg',
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
780 \ 'redraw',
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
781 \ ], 'Xscript')
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
782 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
783 " 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
784 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
785 sleep 100m
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
786 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
787 sleep 100m
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
788 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
789 sleep 100m
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
790 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
791 sleep 100m
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
792 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
793 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
794
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
795 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
796 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
797 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
798 endfunc
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
799
14524
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
800 func Test_incsearch_substitute()
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
801 if !exists('+incsearch')
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
802 return
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
803 endif
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
804 call test_override("char_avail", 1)
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
805 new
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
806 set incsearch
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
807 for n in range(1, 10)
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
808 call setline(n, 'foo ' . n)
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
809 endfor
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
810 4
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
811 call feedkeys(":.,.+2s/foo\<BS>o\<BS>o/xxx\<cr>", 'tx')
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
812 call assert_equal('foo 3', getline(3))
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
813 call assert_equal('xxx 4', getline(4))
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
814 call assert_equal('xxx 5', getline(5))
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
815 call assert_equal('xxx 6', getline(6))
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
816 call assert_equal('foo 7', getline(7))
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
817
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
818 call Incsearch_cleanup()
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
819 endfunc
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
820
14526
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
821 " Similar to Test_incsearch_substitute() but with a screendump halfway.
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
822 func Test_incsearch_substitute_dump()
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
823 if !exists('+incsearch')
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
824 return
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
825 endif
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
826 if !CanRunVimInTerminal()
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
827 return
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
828 endif
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
829 call writefile([
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
830 \ 'set incsearch hlsearch scrolloff=0',
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
831 \ 'for n in range(1, 10)',
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
832 \ ' call setline(n, "foo " . n)',
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
833 \ 'endfor',
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
834 \ '3',
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
835 \ ], 'Xis_subst_script')
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
836 let buf = RunVimInTerminal('-S Xis_subst_script', {'rows': 9, 'cols': 70})
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
837 " Give Vim a chance to redraw to get rid of the spaces in line 2 caused by
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
838 " the 'ambiwidth' check.
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
839 sleep 100m
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
840
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
841 " Need to send one key at a time to force a redraw.
14528
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
842 " Select three lines at the cursor with typed pattern.
14526
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
843 call term_sendkeys(buf, ':.,.+2s/')
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
844 sleep 100m
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
845 call term_sendkeys(buf, 'f')
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
846 sleep 100m
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
847 call term_sendkeys(buf, 'o')
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
848 sleep 100m
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
849 call term_sendkeys(buf, 'o')
14528
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
850 sleep 100m
14526
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
851 call VerifyScreenDump(buf, 'Test_incsearch_substitute_01', {})
14528
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
852 call term_sendkeys(buf, "\<Esc>")
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
853
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
854 " Select three lines at the cursor using previous pattern.
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
855 call term_sendkeys(buf, "/foo\<CR>")
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
856 sleep 100m
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
857 call term_sendkeys(buf, ':.,.+2s//')
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
858 sleep 100m
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
859 call VerifyScreenDump(buf, 'Test_incsearch_substitute_02', {})
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
860
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
861 " Deleting last slash should remove the match.
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
862 call term_sendkeys(buf, "\<BS>")
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
863 sleep 100m
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
864 call VerifyScreenDump(buf, 'Test_incsearch_substitute_03', {})
14526
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
865
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
866 call term_sendkeys(buf, "\<Esc>")
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
867 call StopVimInTerminal(buf)
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
868 call delete('Xis_subst_script')
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
869 endfunc
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
870
12730
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
871 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
872 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
873 return
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
874 endif
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
875 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
876 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
877 return
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
878 endif
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
879 " 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
880 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
881 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
882 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
883 bwipe!
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
884 endfunc
12759
528b227051f8 patch 8.0.1257: no test for fix of undefined behavior
Christian Brabandt <cb@256bit.org>
parents: 12744
diff changeset
885
528b227051f8 patch 8.0.1257: no test for fix of undefined behavior
Christian Brabandt <cb@256bit.org>
parents: 12744
diff changeset
886 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
887 call search("\%UC0000000")
528b227051f8 patch 8.0.1257: no test for fix of undefined behavior
Christian Brabandt <cb@256bit.org>
parents: 12744
diff changeset
888 endfunc
12788
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
889
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
890 " 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
891 func Test_search_multibyte()
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
892 if !has('multi_byte')
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
893 return
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
894 endif
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
895 let save_enc = &encoding
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
896 set encoding=utf8
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
897 enew!
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
898 call append('$', 'A')
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
899 call cursor(2, 1)
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
900 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
901 enew!
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
902 let &encoding = save_enc
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
903 endfunc
13043
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
904
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
905 " 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
906 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
907 new
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
908 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
909 call search(getline("."))
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
910 bwipe!
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
911 endfunc
13082
a80082fd1a1d patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13043
diff changeset
912
a80082fd1a1d patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13043
diff changeset
913 func Test_search_sentence()
a80082fd1a1d patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13043
diff changeset
914 new
a80082fd1a1d patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13043
diff changeset
915 " 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
916 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
917 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
918 /\%'(
25ab78f14c8b patch 8.0.1417: test doesn't search for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13082
diff changeset
919 /
13082
a80082fd1a1d patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13043
diff changeset
920 endfunc