From: Benno Schulenberg Date: Sat, 19 Mar 2016 18:23:37 +0000 (+0000) Subject: Snipping an always-FALSE condition -- do_prompt() will always X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=e291131d0a0744858c8c6e6b2a947df3c88deb68;p=nano.git Snipping an always-FALSE condition -- do_prompt() will always return with -2 when answer is empty, so when answer is empty i cannot be zero. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5747 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 8e1604a5..275838fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ * src/browser.c (do_browser): Delete a snippet of dead code. * src/browser.c (do_browser): Delete an unneeded variable. * src/search.c (do_gotolinecolumn): Delete another unneeded variable. + * src/search.c (search_init): Snip an always-FALSE condition. 2016-03-17 Benno Schulenberg * src/search.c (do_research): Use the Search key bindings also during diff --git a/src/search.c b/src/search.c index 0ef9f3e2..59d2f1be 100644 --- a/src/search.c +++ b/src/search.c @@ -192,9 +192,9 @@ int search_init(bool replacing, bool use_answer) free(backupstring); backupstring = NULL; - /* Cancel any search, or just return with no previous search. */ - if (i == -1 || (i < 0 && *last_search == '\0') || - (!replacing && i == 0 && *answer == '\0')) { + /* If the search was cancelled, or we have a blank answer and + * nothing was searched for yet during this session, get out. */ + if (i == -1 || (i == -2 && *last_search == '\0')) { statusbar(_("Cancelled")); return -1; } else {