diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-09-29 07:36:20 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-09-29 19:23:46 -0400 |
commit | 621f7b607f977289717f4bea486c96dbe5bf64f3 (patch) | |
tree | dcdeeaec6f77f88797627868ca1b1f2bcbf04236 | |
parent | 090551a802489d88be221f5893f49f2188037223 (diff) | |
download | rneovim-621f7b607f977289717f4bea486c96dbe5bf64f3.tar.gz rneovim-621f7b607f977289717f4bea486c96dbe5bf64f3.tar.bz2 rneovim-621f7b607f977289717f4bea486c96dbe5bf64f3.zip |
vim-patch:8.1.1965: search count message is not displayed when using a mapping
Problem: The search count message is not displayed when using a mapping.
(Gary Johnson)
Solution: Ignore cmd_silent for showing the search count. (Christian
Brabandt)
https://github.com/vim/vim/commit/359ad1a6f92d0d3b4b942ea003fb02dc57bbfc9e
-rw-r--r-- | src/nvim/search.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c index 517db05a40..091068d385 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,7 +1365,7 @@ 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) { |