nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] [PATCH 4/4] input: properly recognize Alt+Delete when using


From: Benno Schulenberg
Subject: [Nano-devel] [PATCH 4/4] input: properly recognize Alt+Delete when using -K/--rebindkeypad
Date: Sun, 28 Oct 2018 14:41:04 +0100

From: David Lawrence Ramsey <address@hidden>

This works on xterm, rxvt, Eterm, Konsole, and xfce4-terminal, which
generate "Esc [ 3 ; 3 ~", and urxvt, which generates "Esc Esc [ 3 ~".
---
 src/winio.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/winio.c b/src/winio.c
index c8bfc98b..c59e3d9c 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -494,6 +494,16 @@ int parse_kbinput(WINDOW *win)
                                                ('a' <= *key_buffer && 
*key_buffer <= 'd'))) {
                                /* An iTerm2/Eterm/rxvt sequence: ^[ ^[ [ X. */
                                double_esc = TRUE;
+#ifndef NANO_TINY
+                       } else if (keycode == '[' && key_buffer_len > 1 &&
+                                       key_buffer[0] == '3' && key_buffer[1] 
== '~') {
+                               /* Esc Esc [ 3 ~ is Alt-Delete on urxvt.  First 
consume
+                                * the two waiting codes, then return the 
result. */
+                               kbinput = get_input(win, 1);
+                               kbinput = get_input(win, 1);
+                               retval = ALT_DELETE;
+                               escapes = 0;
+#endif
                        } else {
                                /* Two escapes followed by a non-escape, and 
there are more
                                 * codes waiting: combined meta and escape 
sequence mode. */
@@ -1114,6 +1124,9 @@ int convert_sequence(const int *seq, size_t length, int 
*consumed)
 #ifndef NANO_TINY
                                                if (length > 4 && seq[2] == ';' 
&& seq[4] == '~') {
                                                        *consumed = 5;
+                                                       if (seq[3] == '3')
+                                                               /* Esc [ 3 ; 3 
~ == Alt-Delete on xterm/rxvt/Eterm/Terminal. */
+                                                               return 
ALT_DELETE;
                                                        if (seq[3] == '5')
                                                                /* Esc [ 3 ; 5 
~ == Ctrl-Delete on xterm. */
                                                                return 
CONTROL_DELETE;
-- 
2.19.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]