From: Benno Schulenberg Date: Wed, 15 Jul 2015 20:13:05 +0000 (+0000) Subject: Renaming the 'menu' item to 'menus' in the shortcut struct. X-Git-Tag: v2.5.0~161 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=1f866c29db99ff8b887be54a70b4a1ff942607ba;p=nano.git Renaming the 'menu' item to 'menus' in the shortcut struct. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5301 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index b9e39c12..fd9adb39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,10 @@ doc/man/nanorc.5, doc/texinfo/nano.texi, doc/syntax/nanorc.nanorc: Unabbreviate the long option --const to --constantshow, and --poslog to --positionlog, to be more understandable. + * src/nano.h, src/global.c (add_to_sclist), src/help.c (help_init), + src/rcfile.c (parse_binding), src/winio.c (get_shortcut): Rename + the 'menu' item in the sc (shortcut) struct to 'menus', as it can + refer to more than one menu. 2015-07-13 Benno Schulenberg * src/text.c (do_int_spell_fix, do_alt_speller): Remove an unneeded diff --git a/src/global.c b/src/global.c index be274923..209fc4e8 100644 --- a/src/global.c +++ b/src/global.c @@ -311,7 +311,7 @@ void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *h } /* Add a key combo to the shortcut list. */ -void add_to_sclist(int menu, const char *scstring, void (*func)(void), int toggle) +void add_to_sclist(int menus, const char *scstring, void (*func)(void), int toggle) { static sc *tailsc; static int counter = 0; @@ -326,7 +326,7 @@ void add_to_sclist(int menu, const char *scstring, void (*func)(void), int toggl s->next = NULL; /* Fill in the data. */ - s->menu = menu; + s->menus = menus; s->scfunc = func; s->toggle = toggle; if (toggle) @@ -336,7 +336,7 @@ void add_to_sclist(int menu, const char *scstring, void (*func)(void), int toggl assign_keyinfo(s); #ifdef DEBUG - fprintf(stderr, "Setting sequence to %d for shortcut \"%s\" in menu %x\n", s->seq, scstring, (int)s->menu); + fprintf(stderr, "Setting sequence to %d for shortcut \"%s\" in menus %x\n", s->seq, scstring, s->menus); #endif } @@ -357,7 +357,7 @@ const sc *first_sc_for(int menu, void (*func)(void)) const sc *s; for (s = sclist; s != NULL; s = s->next) - if ((s->menu & menu) && s->scfunc == func) + if ((s->menus & menu) && s->scfunc == func) return s; #ifdef DEBUG diff --git a/src/help.c b/src/help.c index 098d33d9..ab5d50fc 100644 --- a/src/help.c +++ b/src/help.c @@ -413,7 +413,7 @@ void help_init(void) if (s->type == RAWINPUT) continue; - if ((s->menu & currmenu) == 0) + if ((s->menus & currmenu) == 0) continue; if (s->scfunc == f->scfunc) { @@ -456,7 +456,7 @@ void help_init(void) counter++; for (s = sclist; s != NULL; s = s->next) if (s->toggle && s->ordinal == counter) { - ptr += sprintf(ptr, "%s\t\t%s %s\n", (s->menu == MMAIN ? s->keystr : ""), + ptr += sprintf(ptr, "%s\t\t%s %s\n", (s->menus == MMAIN ? s->keystr : ""), _(flagtostr(s->toggle)), _("enable/disable")); if (s->toggle == NO_COLOR_SYNTAX || s->toggle == TABS_TO_SPACES) ptr += sprintf(ptr, "\n"); diff --git a/src/nano.h b/src/nano.h index d3b98d87..851e7dbc 100644 --- a/src/nano.h +++ b/src/nano.h @@ -446,8 +446,8 @@ typedef struct sc { /* What kind of command key it is, for convenience later. */ int seq; /* The actual sequence to check on the type is determined. */ - int menu; - /* What list this applies to. */ + int menus; + /* Which menus this applies to. */ void (*scfunc)(void); /* The function we're going to run. */ int toggle; diff --git a/src/rcfile.c b/src/rcfile.c index 0d2aea4c..f07e80ca 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -535,7 +535,7 @@ void parse_binding(char *ptr, bool dobind) } newsc->keystr = keycopy; - newsc->menu = menu; + newsc->menus = menu; newsc->type = strtokeytype(newsc->keystr); assign_keyinfo(newsc); #ifdef DEBUG @@ -552,11 +552,11 @@ void parse_binding(char *ptr, bool dobind) /* Now find and delete any existing same shortcut in the menu(s). */ for (s = sclist; s != NULL; s = s->next) { - if (((s->menu & menu)) && !strcmp(s->keystr, keycopy)) { + if ((s->menus & menu) && !strcmp(s->keystr, keycopy)) { #ifdef DEBUG - fprintf(stderr, "deleting entry from menu %x\n", s->menu); + fprintf(stderr, "deleting entry from among menus %x\n", s->menus); #endif - s->menu &= ~menu; + s->menus &= ~menu; } } diff --git a/src/winio.c b/src/winio.c index b93bdf07..21e4e5f8 100644 --- a/src/winio.c +++ b/src/winio.c @@ -1758,11 +1758,11 @@ const sc *get_shortcut(int *kbinput) #endif for (s = sclist; s != NULL; s = s->next) { - if ((currmenu & s->menu) && *kbinput == s->seq + if ((s->menus & currmenu) && *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, currmenu, s->menu); + s->keystr, meta_key, currmenu, s->menus); #endif return s; }