changeset 16560:8d0ea09e2d81 v8.1.1283

patch 8.1.1283: delaying half a second after the top-bot message commit https://github.com/vim/vim/commit/c7a10b35de70471519d104a74d402c63557f0512 Author: Bram Moolenaar <Bram@vim.org> Date: Mon May 6 21:37:18 2019 +0200 patch 8.1.1283: delaying half a second after the top-bot message Problem: Delaying half a second after the top-bot message. Solution: Instead of the delay add "W" to the search count.
author Bram Moolenaar <Bram@vim.org>
date Mon, 06 May 2019 21:45:06 +0200
parents ea591e0ecf70
children fc49759f7590
files src/search.c src/testdir/test_search_stat.vim src/version.c
diffstat 3 files changed, 23 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/search.c
+++ b/src/search.c
@@ -26,7 +26,7 @@ static void show_pat_in_path(char_u *, i
 #ifdef FEAT_VIMINFO
 static void wvsp_one(FILE *fp, int idx, char *s, int sc);
 #endif
-static void search_stat(int dirc, pos_T *pos, char_u  *msgbuf);
+static void search_stat(int dirc, pos_T *pos, int show_top_bot_msg, char_u  *msgbuf);
 
 /*
  * This file contains various searching-related routines. These fall into
@@ -1294,6 +1294,8 @@ do_search(
      */
     for (;;)
     {
+	int	show_top_bot_msg = FALSE;
+
 	searchstr = pat;
 	dircp = NULL;
 					    /* use previous pattern */
@@ -1524,7 +1526,7 @@ do_search(
 	if (!shortmess(SHM_SEARCH)
 		&& ((dirc == '/' && LT_POS(pos, curwin->w_cursor))
 			    || (dirc == '?' && LT_POS(curwin->w_cursor, pos))))
-	    ui_delay(500L, FALSE);  // leave some time for top_bot_msg
+	    show_top_bot_msg = TRUE;
 
 	if (c == FAIL)
 	{
@@ -1581,7 +1583,7 @@ do_search(
 		&& c != FAIL
 		&& !shortmess(SHM_SEARCHCOUNT)
 		&& msgbuf != NULL)
-	    search_stat(dirc, &pos, msgbuf);
+	    search_stat(dirc, &pos, show_top_bot_msg, msgbuf);
 
 	/*
 	 * The search command can be followed by a ';' to do another search.
@@ -4911,6 +4913,7 @@ linewhite(linenr_T lnum)
 search_stat(
     int	    dirc,
     pos_T   *pos,
+    int	    show_top_bot_msg,
     char_u  *msgbuf)
 {
     int		    save_ws = p_ws;
@@ -4979,8 +4982,9 @@ search_stat(
     }
     if (cur > 0)
     {
-#define STAT_BUF_LEN 10
+#define STAT_BUF_LEN 12
 	char	t[STAT_BUF_LEN] = "";
+	int	len;
 
 #ifdef FEAT_RIGHTLEFT
 	if (curwin->w_p_rl && *curwin->w_p_rlc == 's')
@@ -5006,7 +5010,15 @@ search_stat(
 	    else
 		vim_snprintf(t, STAT_BUF_LEN, "[%d/%d]", cur, cnt);
 	}
-	mch_memmove(msgbuf + STRLEN(msgbuf) - STRLEN(t), t, STRLEN(t));
+
+	len = STRLEN(t);
+	if (show_top_bot_msg && len + 3 < STAT_BUF_LEN)
+	{
+	    STRCPY(t + len, " W");
+	    len += 2;
+	}
+
+	mch_memmove(msgbuf + STRLEN(msgbuf) - len, t, len);
 	if (dirc == '?' && cur == 100)
 	    cur = -1;
 
--- a/src/testdir/test_search_stat.vim
+++ b/src/testdir/test_search_stat.vim
@@ -3,6 +3,8 @@
 " This test is fragile, it might not work interactively, but it works when run
 " as test!
 
+source shared.vim
+
 func! Test_search_stat()
   new
   set shortmess-=S
@@ -79,7 +81,7 @@ func! Test_search_stat()
     set norl
   endif
 
-  " 9) normal, back at top
+  " 9) normal, back at bottom
   call cursor(1,1)
   let @/ = 'foobar'
   let pat = '?foobar\s\+'
@@ -87,6 +89,7 @@ func! Test_search_stat()
   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))
 
   " 10) normal, no match
   call cursor(1,1)
--- a/src/version.c
+++ b/src/version.c
@@ -768,6 +768,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1283,
+/**/
     1282,
 /**/
     1281,