nano

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

commit f0bc94fd021ba612d5d0c6a41b46254c8824cdb6
parent 8720cfcce9ecb874e3701301ee9e41f9346be574
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Mon,  6 May 2019 10:29:45 +0200

tweaks: move the tyding-up-after-a-search to a single exit point

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

diff --git a/src/search.c b/src/search.c @@ -114,9 +114,7 @@ void search_init(bool replacing, bool keep_the_answer) * nothing was searched for yet during this session, get out. */ if (i == -1 || (i == -2 && *last_search == '\0')) { statusbar(_("Cancelled")); - tidy_up_after_search(); - free(thedefault); - return; + break; } /* If Enter was pressed, prepare to do a replace or a search. */ @@ -139,9 +137,7 @@ void search_init(bool replacing, bool keep_the_answer) go_looking(); } - tidy_up_after_search(); - free(thedefault); - return; + break; } func = func_from_key(&i); @@ -157,20 +153,19 @@ void search_init(bool replacing, bool keep_the_answer) } else if (func == flip_replace) { if (ISSET(VIEW_MODE)) { print_view_warning(); - tidy_up_after_search(); - free(thedefault); - return; + break; } replacing = !replacing; } else { if (func == flip_goto) do_gotolinecolumn(openfile->current->lineno, openfile->placewewant + 1, TRUE, TRUE); - tidy_up_after_search(); - free(thedefault); - return; + break; } } + + tidy_up_after_search(); + free(thedefault); } /* Look for needle, starting at (current, current_x). begin is the line