Mercurial > vim
annotate src/testdir/test_search_stat.vim @ 16560:8d0ea09e2d81 v8.1.1283
patch 8.1.1283: delaying half a second after the top-bot message
commit https://github.com/vim/vim/commit/c7a10b35de70471519d104a74d402c63557f0512
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon May 6 21:37:18 2019 +0200
patch 8.1.1283: delaying half a second after the top-bot message
Problem: Delaying half a second after the top-bot message.
Solution: Instead of the delay add "W" to the search count.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 06 May 2019 21:45:06 +0200 |
parents | 5e25171e0e75 |
children | 2c2f5f0173c1 |
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 " |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 " This test is fragile, it might not work interactively, but it works when run |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 " as test! |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 |
16560
8d0ea09e2d81
patch 8.1.1283: delaying half a second after the top-bot message
Bram Moolenaar <Bram@vim.org>
parents:
16533
diff
changeset
|
6 source shared.vim |
8d0ea09e2d81
patch 8.1.1283: delaying half a second after the top-bot message
Bram Moolenaar <Bram@vim.org>
parents:
16533
diff
changeset
|
7 |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 func! Test_search_stat() |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 new |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 set shortmess-=S |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 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
|
12 |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 " 1) match at second line |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 call cursor(1, 1) |
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) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 " 2) Match at last line |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 call cursor(line('$')-2, 1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 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
|
24 let stat = '\[50/50\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 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
|
26 |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 " 3) No search stat |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 set shortmess+=S |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 call cursor(1, 1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 let stat = '\[2/50\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 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
|
32 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
|
33 set shortmess-=S |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
34 |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
35 " 4) Many matches |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
36 call cursor(line('$')-2, 1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
37 let @/ = '.' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
38 let pat = escape(@/, '()*?'). '\s\+' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 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
|
40 let stat = '\[>99/>99\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
41 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
|
42 |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 " 5) Many matches |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 call cursor(1, 1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
45 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
|
46 let stat = '\[2/>99\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
47 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
|
48 |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
49 " 6) right-left |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
50 if exists("+rightleft") |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
51 set rl |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 call cursor(1,1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
53 let @/ = 'foobar' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
54 let pat = 'raboof/\s\+' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
55 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
|
56 let stat = '\[20/2\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
57 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
|
58 set norl |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
59 endif |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
60 |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
61 " 7) right-left bottom |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
62 if exists("+rightleft") |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
63 set rl |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 call cursor('$',1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 let pat = 'raboof?\s\+' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
66 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
|
67 let stat = '\[20/20\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
68 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
|
69 set norl |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
70 endif |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
71 |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
72 " 8) right-left back at top |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
73 if exists("+rightleft") |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
74 set rl |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
75 call cursor('$',1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
76 let pat = 'raboof/\s\+' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
77 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
|
78 let stat = '\[20/1\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
79 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
|
80 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
|
81 set norl |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
82 endif |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
83 |
16560
8d0ea09e2d81
patch 8.1.1283: delaying half a second after the top-bot message
Bram Moolenaar <Bram@vim.org>
parents:
16533
diff
changeset
|
84 " 9) normal, back at bottom |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
85 call cursor(1,1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
86 let @/ = 'foobar' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
87 let pat = '?foobar\s\+' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
88 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
|
89 let stat = '\[20/20\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
90 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
|
91 call assert_match('search hit TOP, continuing at BOTTOM', g:a) |
16560
8d0ea09e2d81
patch 8.1.1283: delaying half a second after the top-bot message
Bram Moolenaar <Bram@vim.org>
parents:
16533
diff
changeset
|
92 call assert_match('\[20/20\] W', Screenline(&lines)) |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
93 |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 " 10) normal, no match |
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 @/ = 'zzzzzz' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
97 let g:a = '' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
98 try |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
99 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
|
100 catch /^Vim\%((\a\+)\)\=:E486/ |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
101 let stat = '' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
102 " 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
|
103 call assert_true(empty(g:a)) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
104 catch |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
105 call assert_false(1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
106 endtry |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
107 |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
108 " close the window |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
109 set shortmess+=S |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
110 bwipe! |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
111 endfunc |