Mercurial > vim
annotate src/testdir/test_search_stat.vim @ 28499:a35d54d01ade v8.2.4774
patch 8.2.4774: crash when using a number for lambda name
Commit: https://github.com/vim/vim/commit/8b91e71441069b1dde9ac9ff9d9a829b1b4aecca
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 17 15:06:35 2022 +0100
patch 8.2.4774: crash when using a number for lambda name
Problem: Crash when using a number for lambda name.
Solution: Check the type of the lambda reference.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 17 Apr 2022 16:15:03 +0200 |
parents | 4c68fb88b73f |
children | 86eb4aba16c3 |
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 |
20647
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
12 call cursor(1, 1) |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
13 |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
14 " searchcount() returns an empty dictionary when previous pattern was not set |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
15 call assert_equal({}, searchcount(#{pattern: ''})) |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
16 " but setting @/ should also work (even 'n' nor 'N' was executed) |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
17 " recompute the count when the last position is different. |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
18 call assert_equal( |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
19 \ #{current: 1, exact_match: 1, total: 40, incomplete: 0, maxcount: 99}, |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
20 \ searchcount(#{pattern: 'foo'})) |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
21 call assert_equal( |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
22 \ #{current: 0, exact_match: 0, total: 10, incomplete: 0, maxcount: 99}, |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
23 \ searchcount(#{pattern: 'fooooobar'})) |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
24 call assert_equal( |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
25 \ #{current: 0, exact_match: 0, total: 10, incomplete: 0, maxcount: 99}, |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
26 \ searchcount(#{pattern: 'fooooobar', pos: [2, 1, 0]})) |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
27 call assert_equal( |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
28 \ #{current: 1, exact_match: 1, total: 10, incomplete: 0, maxcount: 99}, |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
29 \ searchcount(#{pattern: 'fooooobar', pos: [3, 1, 0]})) |
20667
a126f643d566
patch 8.2.0887: searchcount().exact_match is 1 right after a match
Bram Moolenaar <Bram@vim.org>
parents:
20661
diff
changeset
|
30 " on last char of match |
a126f643d566
patch 8.2.0887: searchcount().exact_match is 1 right after a match
Bram Moolenaar <Bram@vim.org>
parents:
20661
diff
changeset
|
31 call assert_equal( |
a126f643d566
patch 8.2.0887: searchcount().exact_match is 1 right after a match
Bram Moolenaar <Bram@vim.org>
parents:
20661
diff
changeset
|
32 \ #{current: 1, exact_match: 1, total: 10, incomplete: 0, maxcount: 99}, |
a126f643d566
patch 8.2.0887: searchcount().exact_match is 1 right after a match
Bram Moolenaar <Bram@vim.org>
parents:
20661
diff
changeset
|
33 \ searchcount(#{pattern: 'fooooobar', pos: [3, 9, 0]})) |
a126f643d566
patch 8.2.0887: searchcount().exact_match is 1 right after a match
Bram Moolenaar <Bram@vim.org>
parents:
20661
diff
changeset
|
34 " on char after match |
a126f643d566
patch 8.2.0887: searchcount().exact_match is 1 right after a match
Bram Moolenaar <Bram@vim.org>
parents:
20661
diff
changeset
|
35 call assert_equal( |
a126f643d566
patch 8.2.0887: searchcount().exact_match is 1 right after a match
Bram Moolenaar <Bram@vim.org>
parents:
20661
diff
changeset
|
36 \ #{current: 1, exact_match: 0, total: 10, incomplete: 0, maxcount: 99}, |
a126f643d566
patch 8.2.0887: searchcount().exact_match is 1 right after a match
Bram Moolenaar <Bram@vim.org>
parents:
20661
diff
changeset
|
37 \ searchcount(#{pattern: 'fooooobar', pos: [3, 10, 0]})) |
20647
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
38 call assert_equal( |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
39 \ #{current: 1, exact_match: 0, total: 10, incomplete: 0, maxcount: 99}, |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
40 \ searchcount(#{pattern: 'fooooobar', pos: [4, 1, 0]})) |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
41 call assert_equal( |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
42 \ #{current: 1, exact_match: 0, total: 2, incomplete: 2, maxcount: 1}, |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
43 \ searchcount(#{pattern: 'fooooobar', pos: [4, 1, 0], maxcount: 1})) |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
44 call assert_equal( |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
45 \ #{current: 0, exact_match: 0, total: 2, incomplete: 2, maxcount: 1}, |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
46 \ searchcount(#{pattern: 'fooooobar', maxcount: 1})) |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
47 |
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
|
48 " match at second line |
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 let messages_before = execute('messages') |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
50 let @/ = 'fo*\(bar\?\)\?' |
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/50\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
53 let pat = escape(@/, '()*?'). '\s\+' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
54 call assert_match(pat .. stat, g:a) |
20647
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
55 call assert_equal( |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
56 \ #{current: 2, exact_match: 1, total: 50, incomplete: 0, maxcount: 99}, |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
57 \ searchcount(#{recompute: 0})) |
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
|
58 " 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
|
59 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
|
60 |
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
|
61 " Match at last line |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
62 call cursor(line('$')-2, 1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
63 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
|
64 let stat = '\[50/50\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 call assert_match(pat .. stat, g:a) |
20647
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
66 call assert_equal( |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
67 \ #{current: 50, exact_match: 1, total: 50, incomplete: 0, maxcount: 99}, |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
68 \ searchcount(#{recompute: 0})) |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
69 |
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
|
70 " No search stat |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
71 set shortmess+=S |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
72 call cursor(1, 1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
73 let stat = '\[2/50\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
74 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
|
75 call assert_notmatch(pat .. stat, g:a) |
20647
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
76 " n does not update search stat |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
77 call assert_equal( |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
78 \ #{current: 50, exact_match: 1, total: 50, incomplete: 0, maxcount: 99}, |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
79 \ searchcount(#{recompute: 0})) |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
80 call assert_equal( |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
81 \ #{current: 2, exact_match: 1, total: 50, incomplete: 0, maxcount: 99}, |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
82 \ searchcount(#{recompute: v:true})) |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
83 set shortmess-=S |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
84 |
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
|
85 " Many matches |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
86 call cursor(line('$')-2, 1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
87 let @/ = '.' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
88 let pat = escape(@/, '()*?'). '\s\+' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
89 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
|
90 let stat = '\[>99/>99\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
91 call assert_match(pat .. stat, g:a) |
20647
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
92 call assert_equal( |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
93 \ #{current: 100, exact_match: 0, total: 100, incomplete: 2, maxcount: 99}, |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
94 \ searchcount(#{recompute: 0})) |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
95 call assert_equal( |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
96 \ #{current: 272, exact_match: 1, total: 280, incomplete: 0, maxcount: 0}, |
20661
c7843f009ecf
patch 8.2.0884: searchcount() test fails on slower systems
Bram Moolenaar <Bram@vim.org>
parents:
20647
diff
changeset
|
97 \ searchcount(#{recompute: v:true, maxcount: 0, timeout: 200})) |
20647
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
98 call assert_equal( |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
99 \ #{current: 1, exact_match: 1, total: 280, incomplete: 0, maxcount: 0}, |
20661
c7843f009ecf
patch 8.2.0884: searchcount() test fails on slower systems
Bram Moolenaar <Bram@vim.org>
parents:
20647
diff
changeset
|
100 \ searchcount(#{recompute: 1, maxcount: 0, pos: [1, 1, 0], timeout: 200})) |
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
|
101 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
|
102 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
|
103 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
|
104 call assert_match(pat .. stat, g:a) |
20647
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
105 call assert_equal( |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
106 \ #{current: 1, exact_match: 1, total: 100, incomplete: 2, maxcount: 99}, |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
107 \ searchcount(#{recompute: 0})) |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
108 call assert_equal( |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
109 \ #{current: 1, exact_match: 1, total: 280, incomplete: 0, maxcount: 0}, |
20661
c7843f009ecf
patch 8.2.0884: searchcount() test fails on slower systems
Bram Moolenaar <Bram@vim.org>
parents:
20647
diff
changeset
|
110 \ searchcount(#{recompute: 1, maxcount: 0, timeout: 200})) |
20647
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
111 call assert_equal( |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
112 \ #{current: 271, exact_match: 1, total: 280, incomplete: 0, maxcount: 0}, |
20661
c7843f009ecf
patch 8.2.0884: searchcount() test fails on slower systems
Bram Moolenaar <Bram@vim.org>
parents:
20647
diff
changeset
|
113 \ searchcount(#{recompute: 1, maxcount: 0, pos: [line('$')-2, 1, 0], timeout: 200})) |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
114 |
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
|
115 " Many matches |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
116 call cursor(1, 1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
117 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
|
118 let stat = '\[2/>99\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
119 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
|
120 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
|
121 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
|
122 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
|
123 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
|
124 |
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
|
125 " right-left |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
126 if exists("+rightleft") |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
127 set rl |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
128 call cursor(1,1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
129 let @/ = 'foobar' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
130 let pat = 'raboof/\s\+' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
131 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
|
132 let stat = '\[20/2\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
133 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
|
134 set norl |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
135 endif |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
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 " right-left bottom |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
138 if exists("+rightleft") |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
139 set rl |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
140 call cursor('$',1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
141 let pat = 'raboof?\s\+' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
142 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
|
143 let stat = '\[20/20\]' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
144 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
|
145 set norl |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
146 endif |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
147 |
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
|
148 " right-left back at top |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
149 if exists("+rightleft") |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
150 set rl |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
151 call cursor('$',1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
152 let pat = 'raboof/\s\+' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
153 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
|
154 let stat = 'W \[20/1\]' |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
155 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
|
156 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
|
157 set norl |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
158 endif |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
159 |
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
|
160 " normal, back at bottom |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
161 call cursor(1,1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
162 let @/ = 'foobar' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
163 let pat = '?foobar\s\+' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
164 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
|
165 let stat = 'W \[20/20\]' |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
166 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
|
167 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
|
168 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
|
169 |
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
|
170 " normal, no match |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
171 call cursor(1,1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
172 let @/ = 'zzzzzz' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
173 let g:a = '' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
174 try |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
175 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
|
176 catch /^Vim\%((\a\+)\)\=:E486/ |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
177 let stat = '' |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
178 " 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
|
179 call assert_true(empty(g:a)) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
180 catch |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
181 call assert_false(1) |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
182 endtry |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
183 |
16776
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
184 " 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
|
185 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
|
186 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
|
187 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
|
188 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
|
189 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
|
190 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
|
191 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
|
192 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
|
193 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
|
194 |
7d4c814a8554
patch 8.1.1390: search stats are off when using count or offset
Bram Moolenaar <Bram@vim.org>
parents:
16746
diff
changeset
|
195 " 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
|
196 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
|
197 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
|
198 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
|
199 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
|
200 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
|
201 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
|
202 |
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
|
203 " 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
|
204 " 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
|
205 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
|
206 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
|
207 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
|
208 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
|
209 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
|
210 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
|
211 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
|
212 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
|
213 " 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
|
214 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
|
215 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
|
216 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
|
217 unmap n |
2c2f5f0173c1
patch 8.1.1288: search stats don't show for mapped command
Bram Moolenaar <Bram@vim.org>
parents:
16560
diff
changeset
|
218 |
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
|
219 " 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
|
220 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
|
221 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
|
222 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
|
223 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
|
224 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
|
225 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
|
226 |
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
|
227 " 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
|
228 " 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
|
229 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
|
230 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
|
231 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
|
232 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
|
233 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
|
234 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
|
235 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
|
236 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
|
237 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
|
238 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
|
239 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
|
240 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
|
241 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
|
242 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
|
243 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
|
244 " 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
|
245 " 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
|
246 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
|
247 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
|
248 |
20647
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
249 " Time out |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
250 %delete _ |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
251 call append(0, repeat(['foobar', 'foo', 'fooooobar', 'foba', 'foobar'], 100000)) |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
252 call cursor(1, 1) |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
253 call assert_equal(1, searchcount(#{pattern: 'foo', maxcount: 0, timeout: 1}).incomplete) |
8a2b86a39ef4
patch 8.2.0877: cannot get the search statistics
Bram Moolenaar <Bram@vim.org>
parents:
20573
diff
changeset
|
254 |
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
|
255 " 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
|
256 set shortmess+=S |
16533
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
257 " close the window |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
258 bwipe! |
5e25171e0e75
patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
259 endfunc |
17968
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
260 |
20685
4c66962d322b
patch 8.2.0896: crash when calling searchcount() with a string
Bram Moolenaar <Bram@vim.org>
parents:
20667
diff
changeset
|
261 func Test_searchcount_fails() |
4c66962d322b
patch 8.2.0896: crash when calling searchcount() with a string
Bram Moolenaar <Bram@vim.org>
parents:
20667
diff
changeset
|
262 call assert_fails('echo searchcount("boo!")', 'E715:') |
22375
595ea7f099cd
patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
263 call assert_fails('echo searchcount({"timeout" : []})', 'E745:') |
595ea7f099cd
patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
264 call assert_fails('echo searchcount({"maxcount" : []})', 'E745:') |
595ea7f099cd
patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
265 call assert_fails('echo searchcount({"pattern" : []})', 'E730:') |
595ea7f099cd
patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
266 call assert_fails('echo searchcount({"pos" : 1})', 'E475:') |
595ea7f099cd
patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
267 call assert_fails('echo searchcount({"pos" : [1]})', 'E475:') |
595ea7f099cd
patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
268 call assert_fails('echo searchcount({"pos" : [[], 2, 3]})', 'E745:') |
595ea7f099cd
patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
269 call assert_fails('echo searchcount({"pos" : [1, [], 3]})', 'E745:') |
595ea7f099cd
patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
270 call assert_fails('echo searchcount({"pos" : [1, 2, []]})', 'E745:') |
20685
4c66962d322b
patch 8.2.0896: crash when calling searchcount() with a string
Bram Moolenaar <Bram@vim.org>
parents:
20667
diff
changeset
|
271 endfunc |
4c66962d322b
patch 8.2.0896: crash when calling searchcount() with a string
Bram Moolenaar <Bram@vim.org>
parents:
20667
diff
changeset
|
272 |
20697
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
273 func Test_searchcount_in_statusline() |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
274 CheckScreendump |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
275 |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
276 let lines =<< trim END |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
277 set shortmess-=S |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
278 call append(0, 'this is something') |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
279 function TestSearchCount() abort |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
280 let search_count = searchcount() |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
281 if !empty(search_count) |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
282 return '[' . search_count.current . '/' . search_count.total . ']' |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
283 else |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
284 return '' |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
285 endif |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
286 endfunction |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
287 set hlsearch |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
288 set laststatus=2 statusline+=%{TestSearchCount()} |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
289 END |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
290 call writefile(lines, 'Xsearchstatusline') |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
291 let buf = RunVimInTerminal('-S Xsearchstatusline', #{rows: 10}) |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
292 call TermWait(buf) |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
293 call term_sendkeys(buf, "/something") |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
294 call VerifyScreenDump(buf, 'Test_searchstat_4', {}) |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
295 |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
296 call term_sendkeys(buf, "\<Esc>") |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
297 call StopVimInTerminal(buf) |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
298 call delete('Xsearchstatusline') |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
299 endfunc |
1260b27535b5
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents:
20685
diff
changeset
|
300 |
20573
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
301 func Test_search_stat_foldopen() |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
302 CheckScreendump |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
303 |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
304 let lines =<< trim END |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
305 set shortmess-=S |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
306 setl foldenable foldmethod=indent foldopen-=search |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
307 call append(0, ['if', "\tfoo", "\tfoo", 'endif']) |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
308 let @/ = 'foo' |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
309 call cursor(1,1) |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
310 norm n |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
311 END |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
312 call writefile(lines, 'Xsearchstat1') |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
313 |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
314 let buf = RunVimInTerminal('-S Xsearchstat1', #{rows: 10}) |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
315 call VerifyScreenDump(buf, 'Test_searchstat_3', {}) |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
316 |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
317 call term_sendkeys(buf, "n") |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
318 call VerifyScreenDump(buf, 'Test_searchstat_3', {}) |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
319 |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
320 call term_sendkeys(buf, "n") |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
321 call VerifyScreenDump(buf, 'Test_searchstat_3', {}) |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
322 |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
323 call StopVimInTerminal(buf) |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
324 call delete('Xsearchstat1') |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
325 endfunc |
00fff78a929a
patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
326 |
17968
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
327 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
|
328 CheckScreendump |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
329 |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
330 let lines =<< trim END |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
331 set shortmess-=S |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
332 " 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
|
333 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
|
334 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
|
335 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
|
336 nnoremap n n |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
337 let @/ = 'find this' |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
338 call cursor(1,1) |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
339 norm n |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
340 END |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
341 call writefile(lines, 'Xsearchstat') |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
342 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
|
343 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
|
344 |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
345 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
|
346 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
|
347 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
|
348 |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
349 call StopVimInTerminal(buf) |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
350 call delete('Xsearchstat') |
22ddc0ee65e7
patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents:
17948
diff
changeset
|
351 endfunc |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
20798
diff
changeset
|
352 |
26101
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
353 func Test_search_stat_then_gd() |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
354 CheckScreendump |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
355 |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
356 let lines =<< trim END |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
357 call setline(1, ['int cat;', 'int dog;', 'cat = dog;']) |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
358 set shortmess-=S |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
359 set hlsearch |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
360 END |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
361 call writefile(lines, 'Xsearchstatgd') |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
362 |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
363 let buf = RunVimInTerminal('-S Xsearchstatgd', #{rows: 10}) |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
364 call term_sendkeys(buf, "/dog\<CR>") |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
365 call VerifyScreenDump(buf, 'Test_searchstatgd_1', {}) |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
366 |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
367 call term_sendkeys(buf, "G0gD") |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
368 call VerifyScreenDump(buf, 'Test_searchstatgd_2', {}) |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
369 |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
370 call StopVimInTerminal(buf) |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
371 call delete('Xsearchstatgd') |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
372 endfunc |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
373 |
27704
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
374 func Test_search_stat_and_incsearch() |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
375 CheckScreendump |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
376 |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
377 let lines =<< trim END |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
378 call setline(1, ['abc--c', '--------abc', '--abc']) |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
379 set hlsearch |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
380 set incsearch |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
381 set bg=dark |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
382 set showtabline=2 |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
383 |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
384 function MyTabLine() |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
385 try |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
386 let a=searchcount(#{recompute: 1, maxcount: -1}) |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
387 return a.current .. '/' .. a.total |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
388 catch |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
389 return '' |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
390 endtry |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
391 endfunction |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
392 |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
393 set tabline=%!MyTabLine() |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
394 END |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
395 call writefile(lines, 'Xsearchstat_inc') |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
396 |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
397 let buf = RunVimInTerminal('-S Xsearchstat_inc', #{rows: 10}) |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
398 call term_sendkeys(buf, "/abc") |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
399 call TermWait(buf) |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
400 call VerifyScreenDump(buf, 'Test_searchstat_inc_1', {}) |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
401 |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
402 call term_sendkeys(buf, "\<c-g>") |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
403 call TermWait(buf) |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
404 call VerifyScreenDump(buf, 'Test_searchstat_inc_2', {}) |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
405 |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
406 call term_sendkeys(buf, "\<c-g>") |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
407 call TermWait(buf) |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
408 call VerifyScreenDump(buf, 'Test_searchstat_inc_3', {}) |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
409 |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
410 call term_sendkeys(buf, "\<esc>:qa\<cr>") |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
411 call TermWait(buf) |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
412 |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
413 call StopVimInTerminal(buf) |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
414 call delete('Xsearchstat_inc') |
4c68fb88b73f
patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
415 endfunc |
26101
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
416 |
5317b0ae4893
patch 8.2.3583: the "gd" and "gD" commands do not update search stats
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
417 |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
20798
diff
changeset
|
418 " vim: shiftwidth=2 sts=2 expandtab |