mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-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.
c7a10b35de
This commit is contained in:
parent
6cee73195f
commit
e8ca281d3b
@ -1055,6 +1055,8 @@ int do_search(
|
|||||||
* Repeat the search when pattern followed by ';', e.g. "/foo/;?bar".
|
* Repeat the search when pattern followed by ';', e.g. "/foo/;?bar".
|
||||||
*/
|
*/
|
||||||
for (;; ) {
|
for (;; ) {
|
||||||
|
bool show_top_bot_msg = false;
|
||||||
|
|
||||||
searchstr = pat;
|
searchstr = pat;
|
||||||
dircp = NULL;
|
dircp = NULL;
|
||||||
/* use previous pattern */
|
/* use previous pattern */
|
||||||
@ -1261,7 +1263,7 @@ int do_search(
|
|||||||
if (!shortmess(SHM_SEARCH)
|
if (!shortmess(SHM_SEARCH)
|
||||||
&& ((dirc == '/' && lt(pos, curwin->w_cursor))
|
&& ((dirc == '/' && lt(pos, curwin->w_cursor))
|
||||||
|| (dirc == '?' && lt(curwin->w_cursor, pos)))) {
|
|| (dirc == '?' && lt(curwin->w_cursor, pos)))) {
|
||||||
os_delay(500L, false); // leave some time for top_bot_msg
|
show_top_bot_msg = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == FAIL) {
|
if (c == FAIL) {
|
||||||
@ -1312,7 +1314,7 @@ int do_search(
|
|||||||
&& c != FAIL
|
&& c != FAIL
|
||||||
&& !shortmess(SHM_SEARCHCOUNT)
|
&& !shortmess(SHM_SEARCHCOUNT)
|
||||||
&& msgbuf != NULL) {
|
&& 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.
|
// The search command can be followed by a ';' to do another search.
|
||||||
@ -4196,7 +4198,8 @@ int linewhite(linenr_T lnum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add the search count "[3/19]" to "msgbuf".
|
// Add the search count "[3/19]" to "msgbuf".
|
||||||
static void search_stat(int dirc, pos_T *pos, char_u *msgbuf)
|
static void search_stat(int dirc, pos_T *pos,
|
||||||
|
bool show_top_bot_msg, char_u *msgbuf)
|
||||||
{
|
{
|
||||||
int save_ws = p_ws;
|
int save_ws = p_ws;
|
||||||
int wraparound = false;
|
int wraparound = false;
|
||||||
@ -4256,8 +4259,9 @@ static void search_stat(int dirc, pos_T *pos, char_u *msgbuf)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cur > 0) {
|
if (cur > 0) {
|
||||||
#define STAT_BUF_LEN 10
|
#define STAT_BUF_LEN 12
|
||||||
char t[STAT_BUF_LEN] = "";
|
char t[STAT_BUF_LEN] = "";
|
||||||
|
int len;
|
||||||
|
|
||||||
if (curwin->w_p_rl && *curwin->w_p_rlc == 's') {
|
if (curwin->w_p_rl && *curwin->w_p_rlc == 's') {
|
||||||
if (cur == OUT_OF_TIME) {
|
if (cur == OUT_OF_TIME) {
|
||||||
@ -4280,7 +4284,14 @@ static void search_stat(int dirc, pos_T *pos, char_u *msgbuf)
|
|||||||
vim_snprintf(t, STAT_BUF_LEN, "[%d/%d]", cur, cnt);
|
vim_snprintf(t, STAT_BUF_LEN, "[%d/%d]", cur, cnt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
memmove(msgbuf + STRLEN(msgbuf) - len, t, len);
|
||||||
if (dirc == '?' && cur == 100) {
|
if (dirc == '?' && cur == 100) {
|
||||||
cur = -1;
|
cur = -1;
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
" This test is fragile, it might not work interactively, but it works when run
|
" This test is fragile, it might not work interactively, but it works when run
|
||||||
" as test!
|
" as test!
|
||||||
|
|
||||||
|
source shared.vim
|
||||||
|
|
||||||
func! Test_search_stat()
|
func! Test_search_stat()
|
||||||
new
|
new
|
||||||
set shortmess-=S
|
set shortmess-=S
|
||||||
@ -79,7 +81,7 @@ func! Test_search_stat()
|
|||||||
set norl
|
set norl
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" 9) normal, back at top
|
" 9) normal, back at bottom
|
||||||
call cursor(1,1)
|
call cursor(1,1)
|
||||||
let @/ = 'foobar'
|
let @/ = 'foobar'
|
||||||
let pat = '?foobar\s\+'
|
let pat = '?foobar\s\+'
|
||||||
@ -87,6 +89,7 @@ func! Test_search_stat()
|
|||||||
let stat = '\[20/20\]'
|
let stat = '\[20/20\]'
|
||||||
call assert_match(pat .. stat, g:a)
|
call assert_match(pat .. stat, g:a)
|
||||||
call assert_match('search hit TOP, continuing at BOTTOM', 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
|
" 10) normal, no match
|
||||||
call cursor(1,1)
|
call cursor(1,1)
|
||||||
|
Loading…
Reference in New Issue
Block a user