nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit f1e5da6cdd8b02ed028ebf03d2697d0a949e925f
parent d79b9823aea9ce80ec38a6482306351fad227a99
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Tue,  9 Apr 2019 17:54:29 +0200

help: don't doubly list toggles that have two keys assigned to them

Diffstat:
Msrc/global.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/global.c b/src/global.c @@ -397,7 +397,6 @@ void add_to_sclist(int menus, const char *scstring, const int keycode, sclist = s; else tailsc->next = s; - tailsc = s; s->next = NULL; /* Fill in the data. */ @@ -405,11 +404,14 @@ void add_to_sclist(int menus, const char *scstring, const int keycode, s->func = func; #ifndef NANO_TINY s->toggle = toggle; + /* When not the same toggle as the previous one, increment the ID. */ if (toggle) - s->ordinal = ++counter; + s->ordinal = (tailsc->toggle == toggle) ? counter : ++counter; #endif assign_keyinfo(s, scstring, keycode); + tailsc = s; + #ifdef DEBUG fprintf(stderr, "Setting keycode to %d for shortcut \"%s\" in menus %x\n", s->keycode, scstring, s->menus); #endif