]> granicus.if.org Git - vim/commitdiff
patch 8.1.1992: the search stat moves when wrapping at the end of the buffer v8.1.1992
authorBram Moolenaar <Bram@vim.org>
Fri, 6 Sep 2019 18:40:21 +0000 (20:40 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 6 Sep 2019 18:40:21 +0000 (20:40 +0200)
Problem:    The search stat moves when wrapping at the end of the buffer.
Solution:   Put the "W" in front instead of at the end.

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

index ee66052a93d4b6e372014344491ea71092f0f24c..be6daac0dee6052d4a7807b2c486441053f776ce 100644 (file)
@@ -5011,7 +5011,9 @@ search_stat(
        len = STRLEN(t);
        if (show_top_bot_msg && len + 2 < SEARCH_STAT_BUF_LEN)
        {
-           STRCPY(t + len, " W");
+           mch_memmove(t + 2, t, len);
+           t[0] = 'W';
+           t[1] = ' ';
            len += 2;
        }
 
index 57997289d71e45a124057aa6fbeee03533ccc663..3d60716ee7403946dc583e1eba005d1ef766649e 100644 (file)
@@ -43,7 +43,7 @@ func Test_search_stat()
   call assert_match(pat .. stat, g:a)
   call cursor(line('$'), 1)
   let g:a = execute(':unsilent :norm! n')
-  let stat = '\[1/>99\] W'
+  let stat = 'W \[1/>99\]'
   call assert_match(pat .. stat, g:a)
 
   " Many matches
@@ -53,7 +53,7 @@ func Test_search_stat()
   call assert_match(pat .. stat, g:a)
   call cursor(1, 1)
   let g:a = execute(':unsilent :norm! N')
-  let stat = '\[>99/>99\] W'
+  let stat = 'W \[>99/>99\]'
   call assert_match(pat .. stat, g:a)
 
   " right-left
@@ -85,7 +85,7 @@ func Test_search_stat()
     call cursor('$',1)
     let pat = 'raboof/\s\+'
     let g:a = execute(':unsilent :norm! n')
-    let stat = '\[20/1\]'
+    let stat = '\[20/1\]'
     call assert_match(pat .. stat, g:a)
     call assert_match('search hit BOTTOM, continuing at TOP', g:a)
     set norl
@@ -96,10 +96,10 @@ func Test_search_stat()
   let @/ = 'foobar'
   let pat = '?foobar\s\+'
   let g:a = execute(':unsilent :norm! N')
-  let stat = '\[20/20\]'
+  let stat = '\[20/20\]'
   call assert_match(pat .. stat, g:a)
   call assert_match('search hit TOP, continuing at BOTTOM', g:a)
-  call assert_match('\[20/20\] W', Screenline(&lines))
+  call assert_match('W \[20/20\]', Screenline(&lines))
 
   " normal, no match
   call cursor(1,1)
index 4d280332856385e64a00076b714252883b95c508..a21104c59ee2442d1b0f6f9e6ec704f721815859 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1992,
 /**/
     1991,
 /**/