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
This commit is contained in:
Benno Schulenberg 2015-07-15 20:13:05 +00:00
parent cadb4f3689
commit 1f866c29db
6 changed files with 18 additions and 14 deletions

View File

@ -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 <bensberg@justemail.net>
* src/text.c (do_int_spell_fix, do_alt_speller): Remove an unneeded

View File

@ -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

View File

@ -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");

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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;
}