nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit d4945c67a40e07319662c59607324aea6a0c6329
parent ddd300af5ff411b87d6ccbf4dd62a8846371b77c
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Wed, 25 Oct 2017 21:30:53 +0200

search: suppress the "not found" message when replacements were made

After any replacements were made, the "not found" message is pointless
because it will be overwritten rightaway by "Replaced xx occurrences".
The message is confusing and annoying when using speech output.

This partially fixes https://savannah.gnu.org/bugs/?52282.
Reported-by: Chime Hart <chime@hubert-humphrey.com>

Diffstat:
Msrc/search.c | 7+++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/search.c b/src/search.c @@ -291,7 +291,6 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region, /* If we're back at the beginning, then there is no needle. */ if (came_full_circle) { - not_found_msg(needle); enable_waiting(); return 0; } @@ -336,10 +335,8 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region, /* Ensure that the found occurrence is not beyond the starting x. */ if (came_full_circle && ((!ISSET(BACKWARDS_SEARCH) && found_x > begin_x) || - (ISSET(BACKWARDS_SEARCH) && found_x < begin_x))) { - not_found_msg(needle); + (ISSET(BACKWARDS_SEARCH) && found_x < begin_x))) return 0; - } /* Set the current position to point at what we found. */ openfile->current = line; @@ -448,6 +445,8 @@ void go_looking(void) if (didfind == 1 && openfile->current == was_current && openfile->current_x == was_current_x) statusbar(_("This is the only occurrence")); + else if (didfind == 0) + not_found_msg(last_search); #ifdef DEBUG statusline(HUSH, "Took: %.2f", (double)(clock() - start) / CLOCKS_PER_SEC);