[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] Ctrl+Left / Ctrl+Right
From: |
David Lawrence Ramsey |
Subject: |
Re: [Nano-devel] Ctrl+Left / Ctrl+Right |
Date: |
Sun, 17 Dec 2006 16:26:55 -0500 |
User-agent: |
Thunderbird 1.5.0.8 (X11/20061025) |
chulenberg wrote:
<snip>
> Sorry to say it does not. As before, Ctrl+Left and Ctrl+Right just
> produce "[ Unknown Command ]" on the status line.
How about the attached patch, then?
> Of that little group of ten keys, only Insert, Delete, PageUp, and
> PageDown keep on doing what they normally do when used together with
> Ctrl or Alt. Home and End, Up and Down, and Left and Right together
> with Ctrl or Alt produce "[ Unknown Command ]". That seems like an
> asymmetry. Is that intended?
No, but I don't get "Unknown Command" under those circumstances. I'm
using rxvt-unicode 8.1. What terminal are you using?
diff -ur nano/src/nano.h nano-fixed/src/nano.h
--- nano/src/nano.h 2006-11-21 12:17:50.000000000 -0500
+++ nano-fixed/src/nano.h 2006-12-17 16:22:59.000000000 -0500
@@ -467,6 +467,9 @@
/* No key at all. */
#define NANO_NO_KEY -2
+/* Placeholder for NANO_PREVWORD_KEY. */
+#define NANO_FAKE_PREVWORD_KEY -3
+
/* Normal keys. */
#define NANO_XON_KEY NANO_CONTROL_Q
#define NANO_XOFF_KEY NANO_CONTROL_S
diff -ur nano/src/winio.c nano-fixed/src/winio.c
--- nano/src/winio.c 2006-12-02 18:39:16.000000000 -0500
+++ nano-fixed/src/winio.c 2006-12-17 16:23:29.000000000 -0500
@@ -490,6 +490,10 @@
if (retval != ERR) {
switch (retval) {
+ case NANO_FAKE_PREVWORD_KEY:
+ *meta_key = TRUE;
+ retval = NANO_PREVWORD_KEY;
+ break;
case NANO_CONTROL_8:
retval = ISSET(REBIND_DELETE) ? NANO_DELETE_KEY :
NANO_BACKSPACE_KEY;
@@ -611,13 +615,14 @@
#ifdef KEY_SLEFT
/* Slang doesn't support KEY_SLEFT. */
case KEY_SLEFT:
- retval = NANO_BACK_KEY;
+ *meta_key = TRUE;
+ retval = NANO_PREVWORD_KEY;
break;
#endif
#ifdef KEY_SRIGHT
/* Slang doesn't support KEY_SRIGHT. */
case KEY_SRIGHT:
- retval = NANO_FORWARD_KEY;
+ retval = NANO_NEXTWORD_KEY;
break;
#endif
#ifdef KEY_SSUSPEND
@@ -763,9 +768,13 @@
break;
case 'a': /* Esc O a == Ctrl-Up on rxvt. */
case 'b': /* Esc O b == Ctrl-Down on rxvt. */
+ retval = get_escape_seq_abcd(seq[1]);
+ break;
case 'c': /* Esc O c == Ctrl-Right on rxvt. */
+ retval = NANO_NEXTWORD_KEY;
+ break;
case 'd': /* Esc O d == Ctrl-Left on rxvt. */
- retval = get_escape_seq_abcd(seq[1]);
+ retval = NANO_FAKE_PREVWORD_KEY;
break;
case 'j': /* Esc O j == '*' on numeric keypad with
* NumLock off on VT100/VT220/VT320/xterm/
@@ -853,9 +862,13 @@
switch (seq[1]) {
case 'a': /* Esc o a == Ctrl-Up on Eterm. */
case 'b': /* Esc o b == Ctrl-Down on Eterm. */
+ retval = get_escape_seq_abcd(seq[1]);
+ break;
case 'c': /* Esc o c == Ctrl-Right on Eterm. */
+ retval = NANO_NEXTWORD_KEY;
+ break;
case 'd': /* Esc o d == Ctrl-Left on Eterm. */
- retval = get_escape_seq_abcd(seq[1]);
+ retval = NANO_FAKE_PREVWORD_KEY;
break;
}
break;
@@ -925,11 +938,15 @@
* xterm. */
case 'B': /* Esc [ 1 ; 5 B == Ctrl-Down on
* xterm. */
+ retval = get_escape_seq_abcd(seq[4]);
+ break;
case 'C': /* Esc [ 1 ; 5 C == Ctrl-Right on
* xterm. */
+ retval = NANO_NEXTWORD_KEY;
+ break;
case 'D': /* Esc [ 1 ; 5 D == Ctrl-Left on
* xterm. */
- retval = get_escape_seq_abcd(seq[4]);
+ retval = NANO_FAKE_PREVWORD_KEY;
break;
}
}