annotate src/testdir/test_search.vim @ 14556:2bee637a8edc v8.1.0291

patch 8.1.0291: 'incsearch' highlighting not used for :sort commit https://github.com/vim/vim/commit/81f56536b1bc324eb173924a8cf4d7dbbf4f3fdb Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 18 16:19:42 2018 +0200 patch 8.1.0291: 'incsearch' highlighting not used for :sort Problem: 'incsearch' highlighting not used for :sort. Solution: Handle pattern in :sort command.
author Christian Brabandt <cb@256bit.org>
date Sat, 18 Aug 2018 16:30:04 +0200
parents 35e7ead872db
children d84e67a12671
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('.'))
14546
35e7ead872db patch 8.1.0286: 'incsearch' does not apply to :smagic and :snomagic
Christian Brabandt <cb@256bit.org>
parents: 14542
diff changeset
387 undo
35e7ead872db patch 8.1.0286: 'incsearch' does not apply to :smagic and :snomagic
Christian Brabandt <cb@256bit.org>
parents: 14542
diff changeset
388 call feedkeys(":%smagic/the.e/xxx\<cr>", 'tx')
35e7ead872db patch 8.1.0286: 'incsearch' does not apply to :smagic and :snomagic
Christian Brabandt <cb@256bit.org>
parents: 14542
diff changeset
389 call assert_equal(' 2 xxx', getline('.'))
35e7ead872db patch 8.1.0286: 'incsearch' does not apply to :smagic and :snomagic
Christian Brabandt <cb@256bit.org>
parents: 14542
diff changeset
390 undo
35e7ead872db patch 8.1.0286: 'incsearch' does not apply to :smagic and :snomagic
Christian Brabandt <cb@256bit.org>
parents: 14542
diff changeset
391 call assert_fails(":%snomagic/the.e/xxx\<cr>", 'E486')
35e7ead872db patch 8.1.0286: 'incsearch' does not apply to :smagic and :snomagic
Christian Brabandt <cb@256bit.org>
parents: 14542
diff changeset
392 "
35e7ead872db patch 8.1.0286: 'incsearch' does not apply to :smagic and :snomagic
Christian Brabandt <cb@256bit.org>
parents: 14542
diff changeset
393 call feedkeys(":%snomagic/the\\.e/xxx\<cr>", 'tx')
35e7ead872db patch 8.1.0286: 'incsearch' does not apply to :smagic and :snomagic
Christian Brabandt <cb@256bit.org>
parents: 14542
diff changeset
394 call assert_equal(' 2 xxx', 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
395
14524
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
396 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
397 endfunc
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
398
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
399 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
400 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
401 return
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
402 endif
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
403 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
404 1
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
405 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
406 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
407 undo
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
408 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
409 call assert_equal(' 3 the theother', getline(2))
14534
8fa7f5ff2649 patch 8.1.0280: 'incsearch' highlighting does not work for ":g!/"
Christian Brabandt <cb@256bit.org>
parents: 14532
diff changeset
410 undo
8fa7f5ff2649 patch 8.1.0280: 'incsearch' highlighting does not work for ":g!/"
Christian Brabandt <cb@256bit.org>
parents: 14532
diff changeset
411 call feedkeys(":g!/the\<c-l>/d\<cr>", 'tx')
8fa7f5ff2649 patch 8.1.0280: 'incsearch' highlighting does not work for ":g!/"
Christian Brabandt <cb@256bit.org>
parents: 14532
diff changeset
412 call assert_equal(1, line('$'))
8fa7f5ff2649 patch 8.1.0280: 'incsearch' highlighting does not work for ":g!/"
Christian Brabandt <cb@256bit.org>
parents: 14532
diff changeset
413 call assert_equal(' 2 the~e', getline(1))
8fa7f5ff2649 patch 8.1.0280: 'incsearch' highlighting does not work for ":g!/"
Christian Brabandt <cb@256bit.org>
parents: 14532
diff changeset
414 undo
8fa7f5ff2649 patch 8.1.0280: 'incsearch' highlighting does not work for ":g!/"
Christian Brabandt <cb@256bit.org>
parents: 14532
diff changeset
415 call feedkeys(":global!/the\<c-l>/d\<cr>", 'tx')
8fa7f5ff2649 patch 8.1.0280: 'incsearch' highlighting does not work for ":g!/"
Christian Brabandt <cb@256bit.org>
parents: 14532
diff changeset
416 call assert_equal(1, line('$'))
8fa7f5ff2649 patch 8.1.0280: 'incsearch' highlighting does not work for ":g!/"
Christian Brabandt <cb@256bit.org>
parents: 14532
diff changeset
417 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
418
14524
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
419 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
420 endfunc
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
421
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
422 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
423 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
424 return
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
425 endif
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
426 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
427 1
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
428 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
429 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
430 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
431 undo
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
432 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
433 call assert_equal(1, line('$'))
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
434 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
435
14524
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
436 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
437 endfunc
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
438
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
439 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
440 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
441 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
442 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
443 " 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
444 " 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
445 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
446 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
447 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
448 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
449 $
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 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
451 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
452 $
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 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
454 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
455 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
456 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
457 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
458 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
459 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
460 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
461 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
462 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
463 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
464 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
465 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
466 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
467 " 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
468 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
469 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
470 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
471 endfunc
12560
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
472
12664
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
473 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
474 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
475 return
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
476 endif
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
477 " 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
478 " 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
479 new
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
480 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
481 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
482 1
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
483 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
484 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
485 $
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
486 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
487 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
488 " 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
489 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
490 bw!
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
491 endfunc
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
492
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
493 func Test_search_cmdline6()
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
494 " Test that consecutive matches
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
495 " 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
496 if !exists('+incsearch')
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
497 return
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
498 endif
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
499 " 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
500 " 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
501 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
502 new
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
503 call setline(1, [' bbvimb', ''])
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
504 set incsearch
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
505 " first match
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
506 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
507 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
508 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
509 " second match
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
510 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
511 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
512 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
513 " third match
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
514 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
515 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
516 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
517 " first match again
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
518 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
519 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
520 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
521 set nowrapscan
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
522 " last match
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
523 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
524 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
525 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
526 " clean up
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
527 set wrapscan&vim
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
528 set noincsearch
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
529 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
530 bw!
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
531 endfunc
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
532
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
533 func Test_search_cmdline7()
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
534 " 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
535 " 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
536 if !exists('+incsearch')
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
537 return
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
538 endif
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
539 " 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
540 " 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
541 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
542 new
14522
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
543 let @/ = 'b'
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
544 call setline(1, [' bbvimb', ''])
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
545 set incsearch
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
546 " first match
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
547 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
548 " 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
549 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
550 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
551 " 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
552 call feedkeys("/\<cr>", 'tx')
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
553 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
554 " 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
555 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
556 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
557
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
558 " 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
559 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
560 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
561 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
562 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
563 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
564 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
565
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
566 set noincsearch
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
567 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
568 bw!
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
569 endfunc
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
570
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
571 func Test_search_cmdline8()
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
572 " 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
573 " 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
574 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
575 return
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
576 endif
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
577 if has("win32")
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
578 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
579 endif
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
580 let h = winheight(0)
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
581 if h < 3
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
582 return
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
583 endif
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
584 " Prepare buffer text
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
585 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
586 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
587 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
588
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
589 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
590
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
591 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
592 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
593 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
594 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
595 call term_sendkeys(buf, "gg0")
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
596 call term_wait(buf, 500)
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
597 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
598 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
599 \ 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
600 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
601 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
602 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
603 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
604 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
605 " clean up
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
606 call delete('Xsearch.txt')
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
607
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
608 bwipe!
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
609 endfunc
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
610
12560
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
611 " 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
612 func Test_search_regexp()
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
613 enew!
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
614
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
615 put ='1 a aa abb abbccc'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
616 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
617 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
618
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
619 put ='2 d dd dee deefff'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
620 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
621 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
622
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
623 set nomagic
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
624 put ='3 g gg ghh ghhiii'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
625 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
626 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
627
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
628 put ='4 j jj jkk jkklll'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
629 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
630 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
631
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
632 put ='5 m mm mnn mnnooo'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
633 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
634 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
635
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
636 put ='6 x ^aa$ x'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
637 exe 'normal! /\V^aa$' . "\<CR>"
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
638 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
639
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
640 set magic
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
641 put ='7 (a)(b) abbaa'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
642 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
643 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
644
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
645 put ='8 axx [ab]xx'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
646 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
647 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
648
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
649 set undolevels=100
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
650 put ='9 foobar'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
651 put =''
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
652 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
653 normal G
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
654 exe 'normal! dv?bar?' . "\<CR>"
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
655 call assert_equal('9 foo', getline('.'))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
656 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
657 call assert_equal(10, line('$'))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
658 normal u
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
659 call assert_equal('9 foobar', getline('.'))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
660 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
661 call assert_equal(11, line('$'))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
662
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
663 set undolevels&
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
664 enew!
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
665 endfunc
12720
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 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
668 if !exists('+incsearch')
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
669 return
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
670 endif
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
671 set incsearch hlsearch
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
672 " 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
673 " 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
674 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
675 new
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
676 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
677
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
678 1
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
679 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
680 call assert_equal('second', @/)
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
681 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
682
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
683 " 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
684 1
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
685 let @/ = 'last pattern'
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
686 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
687 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
688 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
689 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
690 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
691 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
692 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
693 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
694
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
695 " clean up
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
696 set noincsearch nohlsearch
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
697 bw!
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
698 endfunc
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
699
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
700 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
701 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
702 return
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
703 endif
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
704 let h = winheight(0)
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
705 if h < 3
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
706 return
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
707 endif
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
708
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
709 " Prepare buffer text
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
710 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
711 call writefile(lines, 'Xsearch.txt')
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
712 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
713
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
714 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
715 " 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
716 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
717
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
718 " 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
719 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
720 call term_sendkeys(buf, '/b')
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)
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
722 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
723 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
724 " a0: attr_normal
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
725 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
726 " a1: attr_incsearch
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
727 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
728 " a2: attr_hlsearch
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
729 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
730 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
731 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
732 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
733 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
734
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
735 " Test incremental highlight search
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
736 call term_sendkeys(buf, "/vim")
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
737 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
738 " Buffer:
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
739 " abb vim vim vi
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
740 " vimvivim
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
741 " Search: /vim
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,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
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 " Test <C-g>
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, "\<C-g>\<C-g>")
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 = [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
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 <C-t>
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, "\<C-t>")
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
757 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
758 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
759 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
760 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
761 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
762
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
763 " 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
764 call term_sendkeys(buf, "\<cr>")
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
765 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
766 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
767 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
768 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
769 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
770
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
771 " 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
772 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
773 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
774 call term_sendkeys(buf, "/vim")
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
775 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
776 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
777 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
778 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
779 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
780 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
781
12732
75abce3e933d patch 8.0.1244: search test does not work correctly on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 12730
diff changeset
782 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
783 bwipe!
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
784 endfunc
12730
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
785
13790
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
786 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
787 if !CanRunVimInTerminal()
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
788 return
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
789 endif
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
790 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
791 call writefile([
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
792 \ '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
793 \ '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
794 \ '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
795 \ 'normal gg',
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
796 \ 'redraw',
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
797 \ ], 'Xscript')
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
798 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
799 " 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
800 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
801 sleep 100m
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
802 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
803 sleep 100m
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
804 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
805 sleep 100m
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
806 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
807 sleep 100m
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
808 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
809 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
810
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
811 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
812 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
813 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
814 endfunc
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
815
14524
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
816 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
817 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
818 return
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
819 endif
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
820 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
821 new
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
822 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
823 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
824 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
825 endfor
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
826 4
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
827 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
828 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
829 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
830 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
831 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
832 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
833
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
834 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
835 endfunc
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
836
14526
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
837 " 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
838 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
839 if !exists('+incsearch')
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
840 return
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
841 endif
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
842 if !CanRunVimInTerminal()
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
843 return
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
844 endif
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
845 call writefile([
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
846 \ '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
847 \ '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
848 \ ' 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
849 \ 'endfor',
14542
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
850 \ 'call setline(11, "bar 11")',
14526
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
851 \ '3',
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
852 \ ], 'Xis_subst_script')
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
853 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
854 " 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
855 " the 'ambiwidth' check.
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
856 sleep 100m
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
857
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
858 " 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
859 " 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
860 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
861 sleep 100m
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
862 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
863 sleep 100m
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
864 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
865 sleep 100m
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, 'o')
14528
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
867 sleep 100m
14526
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
868 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
869 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
870
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
871 " 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
872 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
873 sleep 100m
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
874 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
875 sleep 100m
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
876 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
877
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
878 " 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
879 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
880 sleep 100m
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
881 call VerifyScreenDump(buf, 'Test_incsearch_substitute_03', {})
14530
60e0022e6e5d patch 8.1.0278: 'incsearch' highlighting does not accept reverse range
Christian Brabandt <cb@256bit.org>
parents: 14528
diff changeset
882 call term_sendkeys(buf, "\<Esc>")
60e0022e6e5d patch 8.1.0278: 'incsearch' highlighting does not accept reverse range
Christian Brabandt <cb@256bit.org>
parents: 14528
diff changeset
883
60e0022e6e5d patch 8.1.0278: 'incsearch' highlighting does not accept reverse range
Christian Brabandt <cb@256bit.org>
parents: 14528
diff changeset
884 " Reverse range is accepted
60e0022e6e5d patch 8.1.0278: 'incsearch' highlighting does not accept reverse range
Christian Brabandt <cb@256bit.org>
parents: 14528
diff changeset
885 call term_sendkeys(buf, ':5,2s/foo')
60e0022e6e5d patch 8.1.0278: 'incsearch' highlighting does not accept reverse range
Christian Brabandt <cb@256bit.org>
parents: 14528
diff changeset
886 sleep 100m
60e0022e6e5d patch 8.1.0278: 'incsearch' highlighting does not accept reverse range
Christian Brabandt <cb@256bit.org>
parents: 14528
diff changeset
887 call VerifyScreenDump(buf, 'Test_incsearch_substitute_04', {})
14532
58cc47fae12e patch 8.1.0279: 'incsearch' highlighting does not skip white space
Christian Brabandt <cb@256bit.org>
parents: 14530
diff changeset
888 call term_sendkeys(buf, "\<Esc>")
14526
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
889
14532
58cc47fae12e patch 8.1.0279: 'incsearch' highlighting does not skip white space
Christian Brabandt <cb@256bit.org>
parents: 14530
diff changeset
890 " White space after the command is skipped
58cc47fae12e patch 8.1.0279: 'incsearch' highlighting does not skip white space
Christian Brabandt <cb@256bit.org>
parents: 14530
diff changeset
891 call term_sendkeys(buf, ':2,3sub /fo')
58cc47fae12e patch 8.1.0279: 'incsearch' highlighting does not skip white space
Christian Brabandt <cb@256bit.org>
parents: 14530
diff changeset
892 sleep 100m
58cc47fae12e patch 8.1.0279: 'incsearch' highlighting does not skip white space
Christian Brabandt <cb@256bit.org>
parents: 14530
diff changeset
893 call VerifyScreenDump(buf, 'Test_incsearch_substitute_05', {})
14526
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
894 call term_sendkeys(buf, "\<Esc>")
14532
58cc47fae12e patch 8.1.0279: 'incsearch' highlighting does not skip white space
Christian Brabandt <cb@256bit.org>
parents: 14530
diff changeset
895
14538
213f1a519378 patch 8.1.0282: 'incsearch' does not work with command modifiers
Christian Brabandt <cb@256bit.org>
parents: 14534
diff changeset
896 " Command modifiers are skipped
213f1a519378 patch 8.1.0282: 'incsearch' does not work with command modifiers
Christian Brabandt <cb@256bit.org>
parents: 14534
diff changeset
897 call term_sendkeys(buf, ':above below browse botr confirm keepmar keepalt keeppat keepjum filter xxx hide lockm leftabove noau noswap rightbel sandbox silent silent! $tab top unsil vert verbose 4,5s/fo.')
213f1a519378 patch 8.1.0282: 'incsearch' does not work with command modifiers
Christian Brabandt <cb@256bit.org>
parents: 14534
diff changeset
898 sleep 100m
213f1a519378 patch 8.1.0282: 'incsearch' does not work with command modifiers
Christian Brabandt <cb@256bit.org>
parents: 14534
diff changeset
899 call VerifyScreenDump(buf, 'Test_incsearch_substitute_06', {})
213f1a519378 patch 8.1.0282: 'incsearch' does not work with command modifiers
Christian Brabandt <cb@256bit.org>
parents: 14534
diff changeset
900 call term_sendkeys(buf, "\<Esc>")
213f1a519378 patch 8.1.0282: 'incsearch' does not work with command modifiers
Christian Brabandt <cb@256bit.org>
parents: 14534
diff changeset
901
14542
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
902 " Cursorline highlighting at match
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
903 call term_sendkeys(buf, ":set cursorline\<CR>")
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
904 call term_sendkeys(buf, 'G9G')
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
905 call term_sendkeys(buf, ':9,11s/bar')
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
906 sleep 100m
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
907 call VerifyScreenDump(buf, 'Test_incsearch_substitute_07', {})
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
908 call term_sendkeys(buf, "\<Esc>")
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
909
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
910 " Cursorline highlighting at cursor when no match
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
911 call term_sendkeys(buf, ':9,10s/bar')
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
912 sleep 100m
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
913 call VerifyScreenDump(buf, 'Test_incsearch_substitute_08', {})
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
914 call term_sendkeys(buf, "\<Esc>")
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
915
14526
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
916 call StopVimInTerminal(buf)
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
917 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
918 endfunc
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
919
14556
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
920 " Similar to Test_incsearch_substitute_dump() for :sort
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
921 func Test_incsearch_ssort_dump()
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
922 if !exists('+incsearch')
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
923 return
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
924 endif
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
925 if !CanRunVimInTerminal()
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
926 return
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
927 endif
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
928 call writefile([
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
929 \ 'set incsearch hlsearch scrolloff=0',
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
930 \ 'call setline(1, ["another one 2", "that one 3", "the one 1"])',
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
931 \ ], 'Xis_sort_script')
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
932 let buf = RunVimInTerminal('-S Xis_sort_script', {'rows': 9, 'cols': 70})
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
933 " Give Vim a chance to redraw to get rid of the spaces in line 2 caused by
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
934 " the 'ambiwidth' check.
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
935 sleep 100m
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
936
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
937 " Need to send one key at a time to force a redraw.
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
938 call term_sendkeys(buf, ':sort ni u /on')
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
939 sleep 100m
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
940 call VerifyScreenDump(buf, 'Test_incsearch_sort_01', {})
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
941 call term_sendkeys(buf, "\<Esc>")
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
942
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
943 call StopVimInTerminal(buf)
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
944 call delete('Xis_sort_script')
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
945 endfunc
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
946
12730
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
947 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
948 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
949 return
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
950 endif
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
951 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
952 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
953 return
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
954 endif
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
955 " 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
956 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
957 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
958 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
959 bwipe!
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
960 endfunc
12759
528b227051f8 patch 8.0.1257: no test for fix of undefined behavior
Christian Brabandt <cb@256bit.org>
parents: 12744
diff changeset
961
528b227051f8 patch 8.0.1257: no test for fix of undefined behavior
Christian Brabandt <cb@256bit.org>
parents: 12744
diff changeset
962 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
963 call search("\%UC0000000")
528b227051f8 patch 8.0.1257: no test for fix of undefined behavior
Christian Brabandt <cb@256bit.org>
parents: 12744
diff changeset
964 endfunc
12788
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
965
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
966 " 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
967 func Test_search_multibyte()
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
968 if !has('multi_byte')
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
969 return
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
970 endif
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
971 let save_enc = &encoding
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
972 set encoding=utf8
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
973 enew!
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
974 call append('$', 'A')
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
975 call cursor(2, 1)
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
976 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
977 enew!
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
978 let &encoding = save_enc
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
979 endfunc
13043
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
980
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
981 " 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
982 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
983 new
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
984 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
985 call search(getline("."))
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
986 bwipe!
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
987 endfunc
13082
a80082fd1a1d patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13043
diff changeset
988
a80082fd1a1d patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13043
diff changeset
989 func Test_search_sentence()
a80082fd1a1d patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13043
diff changeset
990 new
a80082fd1a1d patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13043
diff changeset
991 " 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
992 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
993 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
994 /\%'(
25ab78f14c8b patch 8.0.1417: test doesn't search for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13082
diff changeset
995 /
13082
a80082fd1a1d patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13043
diff changeset
996 endfunc