Mercurial > vim
annotate src/testdir/test_search_stat.vim @ 18164:f57481564f2c v8.1.2077
patch 8.1.2077: the ops.c file is too big
Commit: https://github.com/vim/vim/commit/4aea03eb875613e3eae2125b84f02b7cd898b2f8
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Sep 25 22:37:17 2019 +0200
patch 8.1.2077: the ops.c file is too big
Problem: The ops.c file is too big.
Solution: Move code for dealing with registers to a new file. (Yegappan
Lakshmanan, closes #4982)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 25 Sep 2019 22:45:03 +0200 |
parents | a9c54c20295c |
children | c087099e9163 |
rev | line source |
---|---|
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 " Tests for search_stats, when "S" is not in 'shortmess' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 |
17968
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
3 source check.vim |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
4 source screendump.vim |
16560
8d0ea09e2d81
patch 8.1.1283: delaying half a second after the top-bot message
Bram Moolenaar <Bram@vim.org>
parents:
16533
diff
changeset
|
5 |
17968
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
6 func Test_search_stat() |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 new |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 set shortmess-=S |
16570
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
9 " Append 50 lines with text to search for, "foobar" appears 20 times |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 call append(0, repeat(['foobar', 'foo', 'fooooobar', 'foba', 'foobar'], 10)) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 |
16746
73ff6357da5b
patch 8.1.1375: without "TS" in 'shortmess' get a hit-enter prompt often
Bram Moolenaar <Bram@vim.org>
parents:
16696
diff
changeset
|
12 " match at second line |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 call cursor(1, 1) |
16746
73ff6357da5b
patch 8.1.1375: without "TS" in 'shortmess' get a hit-enter prompt often
Bram Moolenaar <Bram@vim.org>
parents:
16696
diff
changeset
|
14 let messages_before = execute('messages') |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 let @/ = 'fo*\(bar\?\)\?' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 let g:a = execute(':unsilent :norm! n') |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 let stat = '\[2/50\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 let pat = escape(@/, '()*?'). '\s\+' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 call assert_match(pat .. stat, g:a) |
16746
73ff6357da5b
patch 8.1.1375: without "TS" in 'shortmess' get a hit-enter prompt often
Bram Moolenaar <Bram@vim.org>
parents:
16696
diff
changeset
|
20 " didn't get added to message history |
73ff6357da5b
patch 8.1.1375: without "TS" in 'shortmess' get a hit-enter prompt often
Bram Moolenaar <Bram@vim.org>
parents:
16696
diff
changeset
|
21 call assert_equal(messages_before, execute('messages')) |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 |
16746
73ff6357da5b
patch 8.1.1375: without "TS" in 'shortmess' get a hit-enter prompt often
Bram Moolenaar <Bram@vim.org>
parents:
16696
diff
changeset
|
23 " Match at last line |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 call cursor(line('$')-2, 1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 let g:a = execute(':unsilent :norm! n') |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 let stat = '\[50/50\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 call assert_match(pat .. stat, g:a) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 |
16746
73ff6357da5b
patch 8.1.1375: without "TS" in 'shortmess' get a hit-enter prompt often
Bram Moolenaar <Bram@vim.org>
parents:
16696
diff
changeset
|
29 " No search stat |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 set shortmess+=S |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 call cursor(1, 1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
32 let stat = '\[2/50\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
33 let g:a = execute(':unsilent :norm! n') |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
34 call assert_notmatch(pat .. stat, g:a) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
35 set shortmess-=S |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
36 |
16746
73ff6357da5b
patch 8.1.1375: without "TS" in 'shortmess' get a hit-enter prompt often
Bram Moolenaar <Bram@vim.org>
parents:
16696
diff
changeset
|
37 " Many matches |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
38 call cursor(line('$')-2, 1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 let @/ = '.' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
40 let pat = escape(@/, '()*?'). '\s\+' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
41 let g:a = execute(':unsilent :norm! n') |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
42 let stat = '\[>99/>99\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 call assert_match(pat .. stat, g:a) |
16696
b1756c303066
patch 8.1.1350: "W" for wrapping not shown when more than 99 matches
Bram Moolenaar <Bram@vim.org>
parents:
16570
diff
changeset
|
44 call cursor(line('$'), 1) |
b1756c303066
patch 8.1.1350: "W" for wrapping not shown when more than 99 matches
Bram Moolenaar <Bram@vim.org>
parents:
16570
diff
changeset
|
45 let g:a = execute(':unsilent :norm! n') |
17992
a9c54c20295c
patch 8.1.1992: the search stat moves when wrapping at the end of the buffer
Bram Moolenaar <Bram@vim.org>
parents:
17968
diff
changeset
|
46 let stat = 'W \[1/>99\]' |
16696
b1756c303066
patch 8.1.1350: "W" for wrapping not shown when more than 99 matches
Bram Moolenaar <Bram@vim.org>
parents:
16570
diff
changeset
|
47 call assert_match(pat .. stat, g:a) |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
48 |
16746
73ff6357da5b
patch 8.1.1375: without "TS" in 'shortmess' get a hit-enter prompt often
Bram Moolenaar <Bram@vim.org>
parents:
16696
diff
changeset
|
49 " Many matches |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
50 call cursor(1, 1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
51 let g:a = execute(':unsilent :norm! n') |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 let stat = '\[2/>99\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
53 call assert_match(pat .. stat, g:a) |
16696
b1756c303066
patch 8.1.1350: "W" for wrapping not shown when more than 99 matches
Bram Moolenaar <Bram@vim.org>
parents:
16570
diff
changeset
|
54 call cursor(1, 1) |
b1756c303066
patch 8.1.1350: "W" for wrapping not shown when more than 99 matches
Bram Moolenaar <Bram@vim.org>
parents:
16570
diff
changeset
|
55 let g:a = execute(':unsilent :norm! N') |
17992
a9c54c20295c
patch 8.1.1992: the search stat moves when wrapping at the end of the buffer
Bram Moolenaar <Bram@vim.org>
parents:
17968
diff
changeset
|
56 let stat = 'W \[>99/>99\]' |
16696
b1756c303066
patch 8.1.1350: "W" for wrapping not shown when more than 99 matches
Bram Moolenaar <Bram@vim.org>
parents:
16570
diff
changeset
|
57 call assert_match(pat .. stat, g:a) |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
58 |
16746
73ff6357da5b
patch 8.1.1375: without "TS" in 'shortmess' get a hit-enter prompt often
Bram Moolenaar <Bram@vim.org>
parents:
16696
diff
changeset
|
59 " right-left |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
60 if exists("+rightleft") |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
61 set rl |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
62 call cursor(1,1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
63 let @/ = 'foobar' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 let pat = 'raboof/\s\+' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 let g:a = execute(':unsilent :norm! n') |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
66 let stat = '\[20/2\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
67 call assert_match(pat .. stat, g:a) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
68 set norl |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
69 endif |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
70 |
16746
73ff6357da5b
patch 8.1.1375: without "TS" in 'shortmess' get a hit-enter prompt often
Bram Moolenaar <Bram@vim.org>
parents:
16696
diff
changeset
|
71 " right-left bottom |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
72 if exists("+rightleft") |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
73 set rl |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
74 call cursor('$',1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
75 let pat = 'raboof?\s\+' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
76 let g:a = execute(':unsilent :norm! N') |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
77 let stat = '\[20/20\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
78 call assert_match(pat .. stat, g:a) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
79 set norl |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
80 endif |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
81 |
16746
73ff6357da5b
patch 8.1.1375: without "TS" in 'shortmess' get a hit-enter prompt often
Bram Moolenaar <Bram@vim.org>
parents:
16696
diff
changeset
|
82 " right-left back at top |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
83 if exists("+rightleft") |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
84 set rl |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
85 call cursor('$',1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
86 let pat = 'raboof/\s\+' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
87 let g:a = execute(':unsilent :norm! n') |
17992
a9c54c20295c
patch 8.1.1992: the search stat moves when wrapping at the end of the buffer
Bram Moolenaar <Bram@vim.org>
parents:
17968
diff
changeset
|
88 let stat = 'W \[20/1\]' |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
89 call assert_match(pat .. stat, g:a) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
90 call assert_match('search hit BOTTOM, continuing at TOP', g:a) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
91 set norl |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
92 endif |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
93 |
16746
73ff6357da5b
patch 8.1.1375: without "TS" in 'shortmess' get a hit-enter prompt often
Bram Moolenaar <Bram@vim.org>
parents:
16696
diff
changeset
|
94 " normal, back at bottom |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
95 call cursor(1,1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
96 let @/ = 'foobar' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
97 let pat = '?foobar\s\+' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
98 let g:a = execute(':unsilent :norm! N') |
17992
a9c54c20295c
patch 8.1.1992: the search stat moves when wrapping at the end of the buffer
Bram Moolenaar <Bram@vim.org>
parents:
17968
diff
changeset
|
99 let stat = 'W \[20/20\]' |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
100 call assert_match(pat .. stat, g:a) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
101 call assert_match('search hit TOP, continuing at BOTTOM', g:a) |
17992
a9c54c20295c
patch 8.1.1992: the search stat moves when wrapping at the end of the buffer
Bram Moolenaar <Bram@vim.org>
parents:
17968
diff
changeset
|
102 call assert_match('W \[20/20\]', Screenline(&lines)) |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
103 |
16746
73ff6357da5b
patch 8.1.1375: without "TS" in 'shortmess' get a hit-enter prompt often
Bram Moolenaar <Bram@vim.org>
parents:
16696
diff
changeset
|
104 " normal, no match |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
105 call cursor(1,1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
106 let @/ = 'zzzzzz' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
107 let g:a = '' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
108 try |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
109 let g:a = execute(':unsilent :norm! n') |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
110 catch /^Vim\%((\a\+)\)\=:E486/ |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
111 let stat = '' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
112 " error message is not redir'ed to g:a, it is empty |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
113 call assert_true(empty(g:a)) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
114 catch |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
115 call assert_false(1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
116 endtry |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
117 |
16776
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
118 " with count |
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
119 call cursor(1, 1) |
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
120 let @/ = 'fo*\(bar\?\)\?' |
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
121 let g:a = execute(':unsilent :norm! 2n') |
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
122 let stat = '\[3/50\]' |
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
123 let pat = escape(@/, '()*?'). '\s\+' |
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
124 call assert_match(pat .. stat, g:a) |
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
125 let g:a = execute(':unsilent :norm! 2n') |
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
126 let stat = '\[5/50\]' |
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
127 call assert_match(pat .. stat, g:a) |
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
128 |
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
129 " with offset |
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
130 call cursor(1, 1) |
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
131 call feedkeys("/fo*\\(bar\\?\\)\\?/+1\<cr>", 'tx') |
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
132 let g:a = execute(':unsilent :norm! n') |
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
133 let stat = '\[5/50\]' |
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
134 let pat = escape(@/ .. '/+1', '()*?'). '\s\+' |
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
135 call assert_match(pat .. stat, g:a) |
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
136 |
16746
73ff6357da5b
patch 8.1.1375: without "TS" in 'shortmess' get a hit-enter prompt often
Bram Moolenaar <Bram@vim.org>
parents:
16696
diff
changeset
|
137 " normal, n comes from a mapping |
16570
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
138 " Need to move over more than 64 lines to trigger char_avail(. |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
139 nnoremap n nzv |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
140 call cursor(1,1) |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
141 call append(50, repeat(['foobar', 'foo', 'fooooobar', 'foba', 'foobar'], 10)) |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
142 call setline(2, 'find this') |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
143 call setline(70, 'find this') |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
144 let @/ = 'find this' |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
145 let pat = '/find this\s\+' |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
146 let g:a = execute(':unsilent :norm n') |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
147 " g:a will contain several lines |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
148 let g:b = split(g:a, "\n")[-1] |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
149 let stat = '\[1/2\]' |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
150 call assert_match(pat .. stat, g:b) |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
151 unmap n |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
152 |
16746
73ff6357da5b
patch 8.1.1375: without "TS" in 'shortmess' get a hit-enter prompt often
Bram Moolenaar <Bram@vim.org>
parents:
16696
diff
changeset
|
153 " normal, but silent |
16570
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
154 call cursor(1,1) |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
155 let @/ = 'find this' |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
156 let pat = '/find this\s\+' |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
157 let g:a = execute(':norm! n') |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
158 let stat = '\[1/2\]' |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
159 call assert_notmatch(pat .. stat, g:a) |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
160 |
17948
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
161 " normal, n comes from a silent mapping |
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
162 " First test a normal mapping, then a silent mapping |
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
163 call cursor(1,1) |
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
164 nnoremap n n |
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
165 let @/ = 'find this' |
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
166 let pat = '/find this\s\+' |
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
167 let g:a = execute(':unsilent :norm n') |
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
168 let g:b = split(g:a, "\n")[-1] |
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
169 let stat = '\[1/2\]' |
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
170 call assert_match(pat .. stat, g:b) |
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
171 nnoremap <silent> n n |
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
172 call cursor(1,1) |
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
173 let g:a = execute(':unsilent :norm n') |
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
174 let g:b = split(g:a, "\n")[-1] |
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
175 let stat = '\[1/2\]' |
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
176 call assert_notmatch(pat .. stat, g:b) |
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
177 call assert_match(stat, g:b) |
17968
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
178 " Test that the message is not truncated |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
179 " it would insert '...' into the output. |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
180 call assert_match('^\s\+' .. stat, g:b) |
17948
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
181 unmap n |
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
182 |
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
183 " Clean up |
c77a41ea0365
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Bram Moolenaar <Bram@vim.org>
parents:
16776
diff
changeset
|
184 set shortmess+=S |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
185 " close the window |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
186 bwipe! |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
187 endfunc |
17968
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
188 |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
189 func! Test_search_stat_screendump() |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
190 CheckScreendump |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
191 |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
192 let lines =<< trim END |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
193 set shortmess-=S |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
194 " Append 50 lines with text to search for, "foobar" appears 20 times |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
195 call append(0, repeat(['foobar', 'foo', 'fooooobar', 'foba', 'foobar'], 20)) |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
196 call setline(2, 'find this') |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
197 call setline(70, 'find this') |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
198 nnoremap n n |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
199 let @/ = 'find this' |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
200 call cursor(1,1) |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
201 norm n |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
202 END |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
203 call writefile(lines, 'Xsearchstat') |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
204 let buf = RunVimInTerminal('-S Xsearchstat', #{rows: 10}) |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
205 call term_wait(buf) |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
206 call VerifyScreenDump(buf, 'Test_searchstat_1', {}) |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
207 |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
208 call term_sendkeys(buf, ":nnoremap <silent> n n\<cr>") |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
209 call term_sendkeys(buf, "gg0n") |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
210 call term_wait(buf) |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
211 call VerifyScreenDump(buf, 'Test_searchstat_2', {}) |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
212 |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
213 call StopVimInTerminal(buf) |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
214 call delete('Xsearchstat') |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
215 endfunc |