summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-05-06 21:37:18 +0200
committerBram Moolenaar <Bram@vim.org>2019-05-06 21:37:18 +0200
commitc7a10b35de70471519d104a74d402c63557f0512 (patch)
treec6b836d5a41f0ac44ccb786d83329b12ffe175ee
parent91882cf712119794b5d658bcb10d15dd2fad73ba (diff)
patch 8.1.1283: delaying half a second after the top-bot messagev8.1.1283
Problem: Delaying half a second after the top-bot message. Solution: Instead of the delay add "W" to the search count.
-rw-r--r--src/search.c22
-rw-r--r--src/testdir/test_search_stat.vim5
-rw-r--r--src/version.c2
3 files changed, 23 insertions, 6 deletions
diff --git a/src/search.c b/src/search.c
index 1fa52b443c..dd5519e792 100644
--- a/src/search.c
+++ b/src/search.c
@@ -26,7 +26,7 @@ static void show_pat_in_path(char_u *, int,
#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;
diff --git a/src/testdir/test_search_stat.vim b/src/testdir/test_search_stat.vim
index 37e2fdaef5..57dad81b81 100644
--- 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)
diff --git a/src/version.c b/src/version.c
index 90b6904f2e..892d1a5075 100644
--- 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,