Now that 'currmenu' is really global, stop passing it around.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5043 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
3b031b1bad
commit
49816fed70
|
@ -1,6 +1,8 @@
|
||||||
2014-07-01 Benno Schulenberg <bensberg@justemail.net>
|
2014-07-01 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/browser.c (do_browser), src/help.c (do_help): Make sure
|
* src/browser.c (do_browser), src/help.c (do_help): Make sure
|
||||||
to always set 'currmenu', so that we can rely on it.
|
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>
|
2014-06-30 Mark Majeres <mark@engine12.com>
|
||||||
* src/cut.c, src/global.c, src/nano.c: Rename 'cut_till_end' to
|
* src/cut.c, src/global.c, src/nano.c: Rename 'cut_till_end' to
|
||||||
|
|
|
@ -157,7 +157,7 @@ char *do_browser(char *path, DIR *dir)
|
||||||
#endif /* !DISABLE_MOUSE */
|
#endif /* !DISABLE_MOUSE */
|
||||||
|
|
||||||
parse_browser_input(&kbinput);
|
parse_browser_input(&kbinput);
|
||||||
s = get_shortcut(MBROWSER, &kbinput);
|
s = get_shortcut(&kbinput);
|
||||||
if (!s)
|
if (!s)
|
||||||
continue;
|
continue;
|
||||||
f = sctofunc((sc *) s);
|
f = sctofunc((sc *) s);
|
||||||
|
@ -798,7 +798,7 @@ int filesearch_init(void)
|
||||||
statusbar(_("Cancelled"));
|
statusbar(_("Cancelled"));
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
s = get_shortcut(MBROWSER, &i);
|
s = get_shortcut(&i);
|
||||||
if (i == -2 || i == 0) {
|
if (i == -2 || i == 0) {
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
/* Use last_search if answer is an empty string, or
|
/* Use last_search if answer is an empty string, or
|
||||||
|
|
|
@ -1071,7 +1071,7 @@ void do_insertfile(
|
||||||
|
|
||||||
ans = mallocstrcpy(ans, answer);
|
ans = mallocstrcpy(ans, answer);
|
||||||
|
|
||||||
s = get_shortcut(currmenu, &i);
|
s = get_shortcut(&i);
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
#ifndef DISABLE_MULTIBUFFER
|
#ifndef DISABLE_MULTIBUFFER
|
||||||
|
@ -2291,7 +2291,7 @@ bool do_writeout(bool exiting)
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
ans = mallocstrcpy(ans, answer);
|
ans = mallocstrcpy(ans, answer);
|
||||||
s = get_shortcut(currmenu, &i);
|
s = get_shortcut(&i);
|
||||||
|
|
||||||
#ifndef DISABLE_BROWSER
|
#ifndef DISABLE_BROWSER
|
||||||
if (s && s->scfunc == to_files_void) {
|
if (s && s->scfunc == to_files_void) {
|
||||||
|
|
|
@ -130,7 +130,7 @@ void do_help(void (*refresh_func)(void))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
parse_help_input(&kbinput);
|
parse_help_input(&kbinput);
|
||||||
s = get_shortcut(MHELP, &kbinput);
|
s = get_shortcut(&kbinput);
|
||||||
if (!s)
|
if (!s)
|
||||||
continue;
|
continue;
|
||||||
f = sctofunc((sc *) s);
|
f = sctofunc((sc *) s);
|
||||||
|
|
|
@ -1616,7 +1616,7 @@ int do_input(bool allow_funcs)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check for a shortcut in the main list. */
|
/* 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"
|
/* If we got a shortcut from the main list, or a "universal"
|
||||||
* edit window shortcut, set have_shortcut to TRUE. */
|
* edit window shortcut, set have_shortcut to TRUE. */
|
||||||
|
|
|
@ -81,7 +81,7 @@ int do_statusbar_input(bool *ran_func, bool *finished,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check for a shortcut in the current list. */
|
/* 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"
|
/* If we got a shortcut from the current list, or a "universal"
|
||||||
* statusbar prompt shortcut, set have_shortcut to TRUE. */
|
* statusbar prompt shortcut, set have_shortcut to TRUE. */
|
||||||
|
@ -801,7 +801,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
|
||||||
kbinput = do_statusbar_input(&ran_func, &finished, refresh_func);
|
kbinput = do_statusbar_input(&ran_func, &finished, refresh_func);
|
||||||
assert(statusbar_x <= strlen(answer));
|
assert(statusbar_x <= strlen(answer));
|
||||||
|
|
||||||
s = get_shortcut(currmenu, &kbinput);
|
s = get_shortcut(&kbinput);
|
||||||
|
|
||||||
if (s)
|
if (s)
|
||||||
if (s->scfunc == do_cancel || s->scfunc == do_enter_void)
|
if (s->scfunc == do_cancel || s->scfunc == do_enter_void)
|
||||||
|
@ -1120,7 +1120,7 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||||
|
|
||||||
currmenu = MYESNO;
|
currmenu = MYESNO;
|
||||||
kbinput = get_kbinput(bottomwin);
|
kbinput = get_kbinput(bottomwin);
|
||||||
s = get_shortcut(currmenu, &kbinput);
|
s = get_shortcut(&kbinput);
|
||||||
|
|
||||||
if (s && s->scfunc == do_cancel)
|
if (s && s->scfunc == do_cancel)
|
||||||
ok = -1;
|
ok = -1;
|
||||||
|
|
|
@ -770,7 +770,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
|
||||||
#ifndef DISABLE_MOUSE
|
#ifndef DISABLE_MOUSE
|
||||||
int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
|
int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
|
||||||
#endif
|
#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_line(WINDOW *win, int y, int x, int n);
|
||||||
void blank_titlebar(void);
|
void blank_titlebar(void);
|
||||||
void blank_topbar(void);
|
void blank_topbar(void);
|
||||||
|
|
|
@ -1049,7 +1049,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
s = get_shortcut(currmenu, &i);
|
s = get_shortcut(&i);
|
||||||
|
|
||||||
if (s && s->scfunc == gototext_void) {
|
if (s && s->scfunc == gototext_void) {
|
||||||
/* Keep answer up on the statusbar. */
|
/* Keep answer up on the statusbar. */
|
||||||
|
|
|
@ -2188,12 +2188,13 @@ void do_justify(bool full_justify)
|
||||||
|
|
||||||
/* Display the shortcut list with UnJustify. */
|
/* Display the shortcut list with UnJustify. */
|
||||||
uncutfunc->desc = unjust_tag;
|
uncutfunc->desc = unjust_tag;
|
||||||
|
currmenu = MMAIN;
|
||||||
display_main_list();
|
display_main_list();
|
||||||
|
|
||||||
/* Now get a keystroke and see if it's unjustify. If not, put back
|
/* Now get a keystroke and see if it's unjustify. If not, put back
|
||||||
* the keystroke and return. */
|
* the keystroke and return. */
|
||||||
kbinput = do_input(FALSE);
|
kbinput = do_input(FALSE);
|
||||||
s = get_shortcut(MMAIN, &kbinput);
|
s = get_shortcut(&kbinput);
|
||||||
|
|
||||||
if (s && s->scfunc == do_uncut_text) {
|
if (s && s->scfunc == do_uncut_text) {
|
||||||
/* Splice the justify buffer back into the file, but only if we
|
/* Splice the justify buffer back into the file, but only if we
|
||||||
|
@ -3169,7 +3170,7 @@ void do_linter(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
kbinput = get_kbinput(bottomwin);
|
kbinput = get_kbinput(bottomwin);
|
||||||
s = get_shortcut(currmenu, &kbinput);
|
s = get_shortcut(&kbinput);
|
||||||
tmplint = curlint;
|
tmplint = curlint;
|
||||||
|
|
||||||
if (!s)
|
if (!s)
|
||||||
|
|
|
@ -1790,7 +1790,7 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
|
||||||
* key itself) and meta_key (whether the key is a meta sequence). The
|
* 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
|
* returned shortcut will be the first in the list that corresponds to
|
||||||
* the given sequence. */
|
* the given sequence. */
|
||||||
const sc *get_shortcut(int menu, int *kbinput)
|
const sc *get_shortcut(int *kbinput)
|
||||||
{
|
{
|
||||||
sc *s;
|
sc *s;
|
||||||
|
|
||||||
|
@ -1799,11 +1799,11 @@ const sc *get_shortcut(int menu, int *kbinput)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (s = sclist; s != NULL; s = s->next) {
|
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)) {
|
&& meta_key == (s->type == META)) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf (stderr, "matched seq \"%s\", and btw meta was %d (menu is %x from %x)\n",
|
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
|
#endif
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -1825,7 +1825,7 @@ const subnfunc *getfuncfromkey(WINDOW *win)
|
||||||
if (kbinput == 0)
|
if (kbinput == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
s = get_shortcut(currmenu, &kbinput);
|
s = get_shortcut(&kbinput);
|
||||||
if (!s)
|
if (!s)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue