diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-09-29 22:34:00 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-29 22:34:00 -0400 |
commit | d0d1f0f9a616d4d85f3233561489f34c010f1673 (patch) | |
tree | 3bb5b0a02b572f7c929b4b57c63481329bf1c762 /src/nvim/search.c | |
parent | 090551a802489d88be221f5893f49f2188037223 (diff) | |
parent | 0d100032b885f2eedee96fb7ad6dd660943fc5e3 (diff) | |
download | rneovim-d0d1f0f9a616d4d85f3233561489f34c010f1673.tar.gz rneovim-d0d1f0f9a616d4d85f3233561489f34c010f1673.tar.bz2 rneovim-d0d1f0f9a616d4d85f3233561489f34c010f1673.zip |
Merge pull request #13012 from janlazo/vim-8.1.1965
vim-patch:8.1.{1965,1970,1980,1992},8.2.0840
Diffstat (limited to 'src/nvim/search.c')
-rw-r--r-- | src/nvim/search.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c index 517db05a40..b053459c7f 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -1155,8 +1155,8 @@ int do_search( pat = p; /* put pat after search command */ } - if ((options & SEARCH_ECHO) && messaging() - && !cmd_silent && msg_silent == 0) { + if ((options & SEARCH_ECHO) && messaging() && !msg_silent + && (!cmd_silent || !shortmess(SHM_SEARCHCOUNT))) { char_u *trunc; char_u off_buf[40]; size_t off_len = 0; @@ -1165,7 +1165,8 @@ int do_search( msg_start(); // Get the offset, so we know how long it is. - if (spats[0].off.line || spats[0].off.end || spats[0].off.off) { + if (!cmd_silent + && (spats[0].off.line || spats[0].off.end || spats[0].off.off)) { p = off_buf; // -V507 *p++ = dirc; if (spats[0].off.end) { @@ -1190,14 +1191,14 @@ int do_search( p = searchstr; } - if (!shortmess(SHM_SEARCHCOUNT)) { + if (!shortmess(SHM_SEARCHCOUNT) || cmd_silent) { // Reserve enough space for the search pattern + offset + // search stat. Use all the space available, so that the // search state is right aligned. If there is not enough space // msg_strtrunc() will shorten in the middle. if (ui_has(kUIMessages)) { len = 0; // adjusted below - } else if (msg_scrolled != 0) { + } else if (msg_scrolled != 0 && !cmd_silent) { // Use all the columns. len = (Rows - msg_row) * Columns - 1; } else { @@ -1214,11 +1215,13 @@ int do_search( xfree(msgbuf); msgbuf = xmalloc(len); - { - memset(msgbuf, ' ', len); - msgbuf[0] = dirc; - msgbuf[len - 1] = NUL; + memset(msgbuf, ' ', len); + msgbuf[len - 1] = NUL; + // do not fill the msgbuf buffer, if cmd_silent is set, leave it + // empty for the search_stat feature. + if (!cmd_silent) { + msgbuf[0] = dirc; if (utf_iscomposing(utf_ptr2char(p))) { // Use a space to draw the composing char on. msgbuf[1] = ' '; @@ -1362,12 +1365,15 @@ int do_search( // Show [1/15] if 'S' is not in 'shortmess'. if ((options & SEARCH_ECHO) && messaging() - && !(cmd_silent + msg_silent) + && !msg_silent && c != FAIL && !shortmess(SHM_SEARCHCOUNT) && msgbuf != NULL) { search_stat(dirc, &pos, show_top_bot_msg, msgbuf, - (count != 1 || has_offset)); + (count != 1 + || has_offset + || (!(fdo_flags & FDO_SEARCH) + && hasFolding(curwin->w_cursor.lnum, NULL, NULL)))); } // The search command can be followed by a ';' to do another search. @@ -4356,7 +4362,9 @@ static void search_stat(int dirc, pos_T *pos, len = STRLEN(t); if (show_top_bot_msg && len + 2 < SEARCH_STAT_BUF_LEN) { - STRCPY(t + len, " W"); + memmove(t + 2, t, len); + t[0] = 'W'; + t[1] = ' '; len += 2; } |