diff --git a/ChangeLog b/ChangeLog index 764d3f5f..4be23837 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-04-12 Benno Schulenberg + * src/browser.c (filesearch_init): Stop M-\ and M-/ in WhereisFile + menu (reached via ^R ^T ^W) from doing also an unrequested search + after having performed their function. Fixes Savannah bug #44790. + 2015-04-11 Benno Schulenberg * src/search.c (do_replace_loop): Do not split off the marked region into a separate partition, but do the replacings in the current one, diff --git a/src/browser.c b/src/browser.c index 9db173d3..bdd108c6 100644 --- a/src/browser.c +++ b/src/browser.c @@ -703,7 +703,7 @@ void browser_select_dirname(const char *needle) * program. */ int filesearch_init(void) { - int i = 0; + int input; char *buf; static char *backupstring = NULL; /* The search string we'll be using. */ @@ -727,7 +727,7 @@ int filesearch_init(void) buf = mallocstrcpy(NULL, ""); /* This is now one simple call. It just does a lot. */ - i = do_prompt(FALSE, + input = do_prompt(FALSE, #ifndef DISABLE_TABCOMP TRUE, #endif @@ -743,14 +743,16 @@ int filesearch_init(void) free(backupstring); backupstring = NULL; - /* Cancel any search, or just return with no previous search. */ - if (i == -1 || (i < 0 && *last_search == '\0') || (i == 0 && - *answer == '\0')) { - statusbar(_("Cancelled")); - return -1; - } + /* If only Enter was pressed but we have a previous string, it's okay. */ + if (input == -2 && *last_search != '\0') + return 0; - return 0; + /* Otherwise negative inputs are a bailout. */ + if (input < 0) + statusbar(_("Cancelled")); + + /* Zero is good; positive values mean some function was run. */ + return input; } /* Look for the given needle in the list of files. */ @@ -817,7 +819,7 @@ void do_filesearch(void) UNSET(BACKWARDS_SEARCH); if (filesearch_init() != 0) { - /* Cancelled or a blank search string. */ + /* Cancelled, or a blank search string, or done something. */ bottombars(MBROWSER); return; }