annotate src/testdir/test_search_stat.vim @ 21050:7a9daf73a724 v8.2.1076

patch 8.2.1076: Vim9: no line break allowed in :if expression Commit: https://github.com/vim/vim/commit/faf8626b79e380fe81e7ae2439a535ed7619d27b Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 27 23:07:36 2020 +0200 patch 8.2.1076: Vim9: no line break allowed in :if expression Problem: Vim9: no line break allowed in :if expression. Solution: Skip linebreak.
author Bram Moolenaar <Bram@vim.org>
date Sat, 27 Jun 2020 23:15:03 +0200
parents ce36225c9bed
children 08940efa6b4e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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:')
4c66962d322b patch 8.2.0896: crash when calling searchcount() with a string
Bram Moolenaar <Bram@vim.org>
parents: 20667
diff changeset
263 endfunc
4c66962d322b patch 8.2.0896: crash when calling searchcount() with a string
Bram Moolenaar <Bram@vim.org>
parents: 20667
diff changeset
264
20697
1260b27535b5 patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents: 20685
diff changeset
265 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
266 CheckScreendump
1260b27535b5 patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents: 20685
diff changeset
267
1260b27535b5 patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents: 20685
diff changeset
268 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
269 set shortmess-=S
1260b27535b5 patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents: 20685
diff changeset
270 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
271 function TestSearchCount() abort
1260b27535b5 patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents: 20685
diff changeset
272 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
273 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
274 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
275 else
1260b27535b5 patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents: 20685
diff changeset
276 return ''
1260b27535b5 patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents: 20685
diff changeset
277 endif
1260b27535b5 patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents: 20685
diff changeset
278 endfunction
1260b27535b5 patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents: 20685
diff changeset
279 set hlsearch
1260b27535b5 patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents: 20685
diff changeset
280 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
281 END
1260b27535b5 patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents: 20685
diff changeset
282 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
283 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
284 call TermWait(buf)
1260b27535b5 patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents: 20685
diff changeset
285 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
286 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
287
1260b27535b5 patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents: 20685
diff changeset
288 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
289 call StopVimInTerminal(buf)
1260b27535b5 patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents: 20685
diff changeset
290 call delete('Xsearchstatusline')
1260b27535b5 patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents: 20685
diff changeset
291 endfunc
1260b27535b5 patch 8.2.0902: using searchcount() in 'statusline' causes an error
Bram Moolenaar <Bram@vim.org>
parents: 20685
diff changeset
292
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
293 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
294 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
295
00fff78a929a patch 8.2.0840: search match count wrong when only match is in fold
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
296 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
297 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
298 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
299 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
300 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
301 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
302 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
303 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
304 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
305
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 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
307 call TermWait(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
308 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
309
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 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
311 call TermWait(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
312 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
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 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
315 call TermWait(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
316 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
317
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 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
319 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
320 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
321
17968
22ddc0ee65e7 patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents: 17948
diff changeset
322 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
323 CheckScreendump
22ddc0ee65e7 patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents: 17948
diff changeset
324
22ddc0ee65e7 patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents: 17948
diff changeset
325 let lines =<< trim END
22ddc0ee65e7 patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents: 17948
diff changeset
326 set shortmess-=S
22ddc0ee65e7 patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents: 17948
diff changeset
327 " 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
328 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
329 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
330 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
331 nnoremap n n
22ddc0ee65e7 patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents: 17948
diff changeset
332 let @/ = 'find this'
22ddc0ee65e7 patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents: 17948
diff changeset
333 call cursor(1,1)
22ddc0ee65e7 patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents: 17948
diff changeset
334 norm n
22ddc0ee65e7 patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents: 17948
diff changeset
335 END
22ddc0ee65e7 patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents: 17948
diff changeset
336 call writefile(lines, 'Xsearchstat')
22ddc0ee65e7 patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents: 17948
diff changeset
337 let buf = RunVimInTerminal('-S Xsearchstat', #{rows: 10})
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 17992
diff changeset
338 call TermWait(buf)
17968
22ddc0ee65e7 patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents: 17948
diff changeset
339 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
340
22ddc0ee65e7 patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents: 17948
diff changeset
341 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
342 call term_sendkeys(buf, "gg0n")
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 17992
diff changeset
343 call TermWait(buf)
17968
22ddc0ee65e7 patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents: 17948
diff changeset
344 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
345
22ddc0ee65e7 patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents: 17948
diff changeset
346 call StopVimInTerminal(buf)
22ddc0ee65e7 patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents: 17948
diff changeset
347 call delete('Xsearchstat')
22ddc0ee65e7 patch 8.1.1980: fix for search stat not tested
Bram Moolenaar <Bram@vim.org>
parents: 17948
diff changeset
348 endfunc