2014-07-01 Benno Schulenberg <bensberg@justemail.net>
* src/browser.c (do_browser), src/help.c (do_help): Make sure
to always set 'currmenu', so that we can rely on it.
+ * src/*.c (get_shortcut): Now that 'currmenu' is really global,
+ stop passing it around.
2014-06-30 Mark Majeres <mark@engine12.com>
* src/cut.c, src/global.c, src/nano.c: Rename 'cut_till_end' to
#endif /* !DISABLE_MOUSE */
parse_browser_input(&kbinput);
- s = get_shortcut(MBROWSER, &kbinput);
+ s = get_shortcut(&kbinput);
if (!s)
continue;
f = sctofunc((sc *) s);
statusbar(_("Cancelled"));
return -1;
} else {
- s = get_shortcut(MBROWSER, &i);
+ s = get_shortcut(&i);
if (i == -2 || i == 0) {
#ifdef HAVE_REGEX_H
/* Use last_search if answer is an empty string, or
ans = mallocstrcpy(ans, answer);
- s = get_shortcut(currmenu, &i);
+ s = get_shortcut(&i);
#ifndef NANO_TINY
#ifndef DISABLE_MULTIBUFFER
break;
} else {
ans = mallocstrcpy(ans, answer);
- s = get_shortcut(currmenu, &i);
+ s = get_shortcut(&i);
#ifndef DISABLE_BROWSER
if (s && s->scfunc == to_files_void) {
#endif
parse_help_input(&kbinput);
- s = get_shortcut(MHELP, &kbinput);
+ s = get_shortcut(&kbinput);
if (!s)
continue;
f = sctofunc((sc *) s);
#endif
/* Check for a shortcut in the main list. */
- s = get_shortcut(MMAIN, &input);
+ s = get_shortcut(&input);
/* If we got a shortcut from the main list, or a "universal"
* edit window shortcut, set have_shortcut to TRUE. */
#endif
/* Check for a shortcut in the current list. */
- s = get_shortcut(currmenu, &input);
+ s = get_shortcut(&input);
/* If we got a shortcut from the current list, or a "universal"
* statusbar prompt shortcut, set have_shortcut to TRUE. */
kbinput = do_statusbar_input(&ran_func, &finished, refresh_func);
assert(statusbar_x <= strlen(answer));
- s = get_shortcut(currmenu, &kbinput);
+ s = get_shortcut(&kbinput);
if (s)
if (s->scfunc == do_cancel || s->scfunc == do_enter_void)
currmenu = MYESNO;
kbinput = get_kbinput(bottomwin);
- s = get_shortcut(currmenu, &kbinput);
+ s = get_shortcut(&kbinput);
if (s && s->scfunc == do_cancel)
ok = -1;
#ifndef DISABLE_MOUSE
int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
#endif
-const sc *get_shortcut(int menu, int *kbinput);
+const sc *get_shortcut(int *kbinput);
void blank_line(WINDOW *win, int y, int x, int n);
void blank_titlebar(void);
void blank_topbar(void);
return;
}
- s = get_shortcut(currmenu, &i);
+ s = get_shortcut(&i);
if (s && s->scfunc == gototext_void) {
/* Keep answer up on the statusbar. */
/* Display the shortcut list with UnJustify. */
uncutfunc->desc = unjust_tag;
+ currmenu = MMAIN;
display_main_list();
/* Now get a keystroke and see if it's unjustify. If not, put back
* the keystroke and return. */
kbinput = do_input(FALSE);
- s = get_shortcut(MMAIN, &kbinput);
+ s = get_shortcut(&kbinput);
if (s && s->scfunc == do_uncut_text) {
/* Splice the justify buffer back into the file, but only if we
}
kbinput = get_kbinput(bottomwin);
- s = get_shortcut(currmenu, &kbinput);
+ s = get_shortcut(&kbinput);
tmplint = curlint;
if (!s)
* key itself) and meta_key (whether the key is a meta sequence). The
* returned shortcut will be the first in the list that corresponds to
* the given sequence. */
-const sc *get_shortcut(int menu, int *kbinput)
+const sc *get_shortcut(int *kbinput)
{
sc *s;
#endif
for (s = sclist; s != NULL; s = s->next) {
- if ((menu & s->menu) && *kbinput == s->seq
+ if ((currmenu & s->menu) && *kbinput == s->seq
&& meta_key == (s->type == META)) {
#ifdef DEBUG
fprintf (stderr, "matched seq \"%s\", and btw meta was %d (menu is %x from %x)\n",
- s->keystr, meta_key, menu, s->menu);
+ s->keystr, meta_key, currmenu, s->menu);
#endif
return s;
}
if (kbinput == 0)
return NULL;
- s = get_shortcut(currmenu, &kbinput);
+ s = get_shortcut(&kbinput);
if (!s)
return NULL;