nano

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

commit 998992ddcb9b4512cc65234596b80f6afa612c5b
parent 0ff949958376ac284ec8abd49e024d22bf965056
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Mon, 20 Jan 2020 18:57:25 +0100

tweaks: condense three comments to one, and do the masking more directly

Diffstat:
Msrc/rcfile.c | 17++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/rcfile.c b/src/rcfile.c @@ -806,25 +806,24 @@ void parse_binding(char *ptr, bool dobind) if (!dobind) goto free_things; + /* Limit the given menu to those where the function exists; + * first handle three special cases, then the general case. */ if (is_universal(newsc->func)) - mask = MMOST|MBROWSER; + menu &= MMOST|MBROWSER; #ifndef NANO_TINY - /* Handle the special case of the toggles. */ else if (newsc->func == do_toggle_void) - mask = MMAIN; + menu &= MMAIN; #endif - /* Handle the special case of a key defined as a string. */ else if (newsc->func == (functionptrtype)implant) - mask = MMOST|MBROWSER|MHELP; + menu &= MMOST|MBROWSER|MHELP; else { /* Tally up the menus where the function exists. */ for (funcstruct *f = allfuncs; f != NULL; f = f->next) if (f->func == newsc->func) - mask = mask | f->menus; - } + mask |= f->menus; - /* Now limit the given menu to those where the function exists. */ - menu = menu & mask; + menu &= mask; + } if (!menu) { if (!ISSET(RESTRICTED) && !ISSET(VIEW_MODE))