]> granicus.if.org Git - vim/commitdiff
patch 8.1.1970: search stat space wrong, no test for 8.1.1965 v8.1.1970
authorBram Moolenaar <Bram@vim.org>
Tue, 3 Sep 2019 20:23:38 +0000 (22:23 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 3 Sep 2019 20:23:38 +0000 (22:23 +0200)
Problem:    Search stat space wrong, no test for 8.1.1965.
Solution:   Fix check for cmd_silent.  Add a test. (Christian Brabandt)

src/search.c
src/testdir/test_search_stat.vim
src/version.c

index 758c4ef1aaccde5660dee9a1927144dc5e49399c..ee66052a93d4b6e372014344491ea71092f0f24c 100644 (file)
@@ -1391,7 +1391,7 @@ do_search(
                // search stat.  Use all the space available, so that the
                // search state is right aligned.  If there is not enough space
                // msg_strtrunc() will shorten in the middle.
-               if (msg_scrolled != 0 || cmd_silent)
+               if (msg_scrolled != 0 && !cmd_silent)
                    // Use all the columns.
                    len = (int)(Rows - msg_row) * Columns - 1;
                else
index cf36f3214acb9cf80e968f14e68a45b5e8875d88..d5d50ff1d79e1471f2064f8f96b2aa751baca46f 100644 (file)
@@ -160,7 +160,28 @@ func! Test_search_stat()
   let stat = '\[1/2\]'
   call assert_notmatch(pat .. stat, g:a)
 
-  " close the window
+  " normal, n comes from a silent mapping
+  " First test a normal mapping, then a silent mapping
+  call cursor(1,1)
+  nnoremap n n
+  let @/ = 'find this'
+  let pat = '/find this\s\+'
+  let g:a = execute(':unsilent :norm n')
+  let g:b = split(g:a, "\n")[-1]
+  let stat = '\[1/2\]'
+  call assert_match(pat .. stat, g:b)
+  nnoremap <silent> n n
+  call cursor(1,1)
+  let g:a = execute(':unsilent :norm n')
+  let g:b = split(g:a, "\n")[-1]
+  let stat = '\[1/2\]'
+  call assert_notmatch(pat .. stat, g:b)
+  call assert_match(stat, g:b)
+  unmap n
+
+  " Clean up
   set shortmess+=S
+
+  " close the window
   bwipe!
 endfunc
index 655b68a99e24e646d806bc30c486772dda882870..7b3fff0f98f38d7b7d0fdebc3695035bc94b4283 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1970,
 /**/
     1969,
 /**/