From 621f7b607f977289717f4bea486c96dbe5bf64f3 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 29 Sep 2020 07:36:20 -0400 Subject: 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 --- src/nvim/search.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/nvim/search.c') 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) { -- cgit From 37c6cbc7588717c2e1396779d4d69fb3e3263c2d Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 29 Sep 2020 19:26:35 -0400 Subject: vim-patch:8.1.1970: search stat space wrong, no test for 8.1.1965 Problem: Search stat space wrong, no test for 8.1.1965. Solution: Fix check for cmd_silent. Add a test. (Christian Brabandt) https://github.com/vim/vim/commit/19e8ac72e9c17b894a9c74cb8f70feb33567033c --- src/nvim/search.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/search.c') diff --git a/src/nvim/search.c b/src/nvim/search.c index 091068d385..d379415d62 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -1198,7 +1198,7 @@ int do_search( // msg_strtrunc() will shorten in the middle. if (ui_has(kUIMessages)) { len = 0; // adjusted below - } else if (msg_scrolled != 0 || cmd_silent) { + } else if (msg_scrolled != 0 && !cmd_silent) { // Use all the columns. len = (Rows - msg_row) * Columns - 1; } else { -- cgit From 83ebe0c9988bd4abeda0f7ca0775d50e050b9e55 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 29 Sep 2020 19:45:32 -0400 Subject: vim-patch:8.1.1992: the search stat moves when wrapping at the end of the buffer Problem: The search stat moves when wrapping at the end of the buffer. Solution: Put the "W" in front instead of at the end. https://github.com/vim/vim/commit/16b58ae9f36e9675c34d942f5d5f8c8a7914dbc4 --- src/nvim/search.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/nvim/search.c') diff --git a/src/nvim/search.c b/src/nvim/search.c index d379415d62..a3acf0c27d 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -4359,7 +4359,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; } -- cgit From 0d100032b885f2eedee96fb7ad6dd660943fc5e3 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 29 Sep 2020 19:53:00 -0400 Subject: vim-patch:8.2.0840: search match count wrong when only match is in fold Problem: Search match count wrong when only match is in fold. Solution: Update search stats when in a closed fold. (Christian Brabandt, closes vim/vim#6160, closes vim/vim#6152) https://github.com/vim/vim/commit/6cb0726215519fe94103803e4aa77a355384bcf2 --- src/nvim/search.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/nvim/search.c') diff --git a/src/nvim/search.c b/src/nvim/search.c index a3acf0c27d..b053459c7f 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -1370,7 +1370,10 @@ int do_search( && !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. -- cgit