1
0
forked from aniani/vim

patch 9.0.1518: search stats not always visible when searching backwards

Problem:    Search stats not always visible when searching backwards.
Solution:   Do not display the top/bot message on top of the search stats.
            (Christian Brabandt, closes #12322, closes #12222)
This commit is contained in:
Christian Brabandt
2023-05-06 19:20:20 +01:00
committed by Bram Moolenaar
parent 00d07e7682
commit 34a6a3617b
7 changed files with 70 additions and 6 deletions

View File

@@ -1089,7 +1089,9 @@ searchit(
/*
* If 'wrapscan' is set we continue at the other end of the file.
* If 'shortmess' does not contain 's', we give a message.
* If 'shortmess' does not contain 's', we give a message, but
* only, if we won't show the search stat later anyhow,
* (so SEARCH_COUNT must be absent).
* This message is also remembered in keep_msg for when the screen
* is redrawn. The keep_msg is cleared whenever another message is
* written.
@@ -1098,7 +1100,9 @@ searchit(
lnum = buf->b_ml.ml_line_count;
else
lnum = 1;
if (!shortmess(SHM_SEARCH) && (options & SEARCH_MSG))
if (!shortmess(SHM_SEARCH)
&& shortmess(SHM_SEARCHCOUNT)
&& (options & SEARCH_MSG))
give_warning((char_u *)_(dir == BACKWARD
? top_bot_msg : bot_top_msg), TRUE);
if (extra_arg != NULL)
@@ -3237,8 +3241,10 @@ update_search_stat(
lbuf = curbuf;
}
// when searching backwards and having jumped to the first occurrence,
// cur must remain greater than 1
if (EQUAL_POS(lastpos, *cursor_pos) && !wraparound
&& (dirc == 0 || dirc == '/' ? cur < cnt : cur > 0))
&& (dirc == 0 || dirc == '/' ? cur < cnt : cur > 1))
cur += dirc == 0 ? 0 : dirc == '/' ? 1 : -1;
else
{