commit e938c24d04fe17b09c20b22041fd636c5157bd34
parent f55a3fabef52a219c8ef5213ba51b7b5258a00cf
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 7 Nov 2018 19:30:04 +0100
tweaks: renumber a couple of symbols, and reshuffle a bit of code
Also, contract the regex for key strings.
Diffstat:
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/nano.h b/src/nano.h
@@ -582,19 +582,19 @@ enum
#define CONTROL_DOWN 0x404
#define CONTROL_HOME 0x405
#define CONTROL_END 0x406
-#define CONTROL_DELETE 0x407
+#define CONTROL_DELETE 0x40D
#define SHIFT_CONTROL_LEFT 0x411
#define SHIFT_CONTROL_RIGHT 0x412
#define SHIFT_CONTROL_UP 0x413
#define SHIFT_CONTROL_DOWN 0x414
#define SHIFT_CONTROL_HOME 0x415
#define SHIFT_CONTROL_END 0x416
-#define CONTROL_SHIFT_DELETE 0x417
+#define CONTROL_SHIFT_DELETE 0x41D
#define ALT_LEFT 0x421
#define ALT_RIGHT 0x422
#define ALT_UP 0x423
#define ALT_DOWN 0x424
-#define ALT_DELETE 0x427
+#define ALT_DELETE 0x42D
#define SHIFT_ALT_LEFT 0x431
#define SHIFT_ALT_RIGHT 0x432
#define SHIFT_ALT_UP 0x433
diff --git a/src/winio.c b/src/winio.c
@@ -595,19 +595,19 @@ int parse_kbinput(WINDOW *win)
/* Modifiers are: Alt (8), Ctrl (4), Shift (1). */
if (on_a_vt && 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) {
- /* A shifted <Tab> is a back tab. */
if (retval == TAB_CODE)
return SHIFT_TAB;
shift_held = TRUE;
}
- /* Is Shift being held while Delete is pressed? */
- if (modifiers == 0x01 && retval == KEY_DC)
- return SHIFT_DELETE;
- /* Are Ctrl and Shift being held while Delete is pressed? */
- if (modifiers == 0x05 && retval == KEY_DC)
- return CONTROL_SHIFT_DELETE;
/* Is Alt being held? */
if (modifiers == 0x08) {
if (retval == KEY_DC)
diff --git a/syntax/nanohelp.nanorc b/syntax/nanohelp.nanorc
@@ -5,7 +5,7 @@ syntax nanohelp
# Key combos:
color cyan "\^[]4-8A-Z^\_◀▶▲▼]" "[◀▶▲▼]" "\<M-." "\<F1?[0-9]"
-color cyan "\<(Tab|Sh-Tab|Enter|Ins|Del|Sh-\^?Del|Space|Bsp|Up|Down|Left|Right|Home|End|PgUp|PgDn)\>"
+color cyan "\<((Sh-)?Tab|Enter|Ins|(Sh-\^?)?Del|Space|Bsp|Up|Down|Left|Right|Home|End|PgUp|PgDn)\>"
# Quoted indicators:
color brightred "'(\^|M-)'"