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

This commit is contained in:
Benno Schulenberg 2019-05-06 10:29:45 +02:00
parent 8720cfcce9
commit f0bc94fd02

View File

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