Skip to content

Commit 19e8ac7

Browse files
committed
patch 8.1.1970: search stat space wrong, no test for 8.1.1965
Problem: Search stat space wrong, no test for 8.1.1965. Solution: Fix check for cmd_silent. Add a test. (Christian Brabandt)
1 parent 581ba39 commit 19e8ac7

3 files changed

Lines changed: 25 additions & 2 deletions

File tree

src/search.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,7 @@ do_search(
13911391
// search stat. Use all the space available, so that the
13921392
// search state is right aligned. If there is not enough space
13931393
// msg_strtrunc() will shorten in the middle.
1394-
if (msg_scrolled != 0 || cmd_silent)
1394+
if (msg_scrolled != 0 && !cmd_silent)
13951395
// Use all the columns.
13961396
len = (int)(Rows - msg_row) * Columns - 1;
13971397
else

src/testdir/test_search_stat.vim

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,28 @@ func! Test_search_stat()
160160
let stat = '\[1/2\]'
161161
call assert_notmatch(pat .. stat, g:a)
162162

163-
" close the window
163+
" normal, n comes from a silent mapping
164+
" First test a normal mapping, then a silent mapping
165+
call cursor(1,1)
166+
nnoremap n n
167+
let @/ = 'find this'
168+
let pat = '/find this\s\+'
169+
let g:a = execute(':unsilent :norm n')
170+
let g:b = split(g:a, "\n")[-1]
171+
let stat = '\[1/2\]'
172+
call assert_match(pat .. stat, g:b)
173+
nnoremap <silent> n n
174+
call cursor(1,1)
175+
let g:a = execute(':unsilent :norm n')
176+
let g:b = split(g:a, "\n")[-1]
177+
let stat = '\[1/2\]'
178+
call assert_notmatch(pat .. stat, g:b)
179+
call assert_match(stat, g:b)
180+
unmap n
181+
182+
" Clean up
164183
set shortmess+=S
184+
185+
" close the window
165186
bwipe!
166187
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ static char *(features[]) =
761761

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
1970,
764766
/**/
765767
1969,
766768
/**/

0 commit comments

Comments
 (0)