+2015-04-12 Benno Schulenberg <bensberg@justemail.net>
+ * 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 <bensberg@justemail.net>
* 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,
* program. */
int filesearch_init(void)
{
- int i = 0;
+ int input;
char *buf;
static char *backupstring = NULL;
/* The search string we'll be using. */
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
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')) {
+ /* If only Enter was pressed but we have a previous string, it's okay. */
+ if (input == -2 && *last_search != '\0')
+ return 0;
+
+ /* Otherwise negative inputs are a bailout. */
+ if (input < 0)
statusbar(_("Cancelled"));
- return -1;
- }
- return 0;
+ /* Zero is good; positive values mean some function was run. */
+ return input;
}
/* Look for the given needle in the list of files. */
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;
}