nano

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

commit 433dd92196473507498d825db261f9ef01a502c7
parent 78d284881cba318ec81c05ba96cf85b1a1401f19
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Mon, 15 Aug 2022 12:06:52 +0200

tweaks: drop an unneeded check for permissibility of prompt shortcuts

The only menus that are accessible in view mode are WhereIs, Insert,
WhereIsFile, GoToDirectory, and Help.  In the WhereIs menu, the only
keystroke that is not allowed in view mode (^R) is caught explicitly.
In the other four menus, all available shortcuts are permissible in
view mode, so... there is no need to check them at execution time.

(The ^R keystroke in the WhereIs menu is still shown in view mode
so as not to upset the pairing of the subsequent shortcuts.)

Diffstat:
Msrc/prompt.c | 7++-----
Msrc/prototypes.h | 1-
2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/prompt.c b/src/prompt.c @@ -366,11 +366,8 @@ int do_statusbar_input(bool *finished) } #endif else { - /* Handle any other shortcut in the current menu, setting finished - * to TRUE to indicate that we're done after running or trying to - * run its associated function. */ - if (!ISSET(VIEW_MODE) || okay_for_view(shortcut)) - shortcut->func(); + /* Handle some other shortcut, and indicate that we're done. */ + shortcut->func(); *finished = TRUE; } } diff --git a/src/prototypes.h b/src/prototypes.h @@ -424,7 +424,6 @@ void terminal_init(void); void confirm_margin(void); #endif void unbound_key(int code); -bool okay_for_view(const keystruct *shortcut); void inject(char *burst, size_t count); /* Most functions in prompt.c. */