nano

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

commit 6b9084ad09a263ca4fde6cfe81ccb4b18cf94fd9
parent d0501d0ebd702359b68a3014937af8be79fee81a
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Wed, 22 Jul 2020 20:32:38 +0200

tweaks: reshuffle a few lines, to elide an 'if' from the most common path

And for compactness.

Diffstat:
Msrc/winio.c | 11++++-------
1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/winio.c b/src/winio.c @@ -1127,17 +1127,14 @@ int parse_kbinput(WINDOW *win) /* Modifiers are: Alt (8), Ctrl (4), Shift (1). */ if (on_a_vt && !mute_modifiers && ioctl(0, TIOCLINUX, &modifiers) >= 0) { #ifndef NANO_TINY - /* Is Delete pressed together with Shift or Shift+Ctrl? */ - if (retval == KEY_DC) { - if (modifiers == 0x01) - return SHIFT_DELETE; - if (modifiers == 0x05) - return CONTROL_SHIFT_DELETE; - } /* Is Shift being held? */ if (modifiers & 0x01) { if (retval == '\t') return SHIFT_TAB; + if (retval == KEY_DC && modifiers == 0x01) + return SHIFT_DELETE; + if (retval == KEY_DC && modifiers == 0x05) + return CONTROL_SHIFT_DELETE; if (!meta_key) shift_held = TRUE; }