nano

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

commit 54103d8ed10972fb57bce8fb559ccb97ac1ac649
parent 53a10ddcaf1b38fe1ad80a9b55ea796bcc904b4b
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun, 25 Feb 2018 10:41:51 +0100

tweaks: elide another variable, to call a function less often

Instead of always calling sctofunc(), it is now only called when
in view mode OR when (after the keystroke's function has been run)
no need for a refresh has been established yet.

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

diff --git a/src/nano.c b/src/nano.c @@ -1708,9 +1708,7 @@ int do_input(bool allow_funcs) if (shortcut == NULL) pletion_line = NULL; else { - const subnfunc *f = sctofunc(shortcut); - - if (ISSET(VIEW_MODE) && f && !f->viewok) { + if (ISSET(VIEW_MODE) && !sctofunc(shortcut)->viewok) { print_view_warning(); return ERR; } @@ -1776,7 +1774,7 @@ int do_input(bool allow_funcs) wrap_reset(); #endif #ifdef ENABLE_COLOR - if (f && !f->viewok && !refresh_needed) + if (!refresh_needed && !sctofunc(shortcut)->viewok) check_the_multis(openfile->current); #endif if (!refresh_needed && (shortcut->func == do_delete ||