Line 0
Link Here
|
|
|
1 |
Revision 212235 |
2 |
libedit: Try to map <Delete> to ed-delete-next-char. |
3 |
|
4 |
This adds a new "arrow" key "delete" corresponding to the kD termcap |
5 |
value. It only works if that is a sequence such as "\033[3~"; if it is |
6 |
"\177", the em-delete-prev-char or ed-delete-prev-char from the |
7 |
single-character mappings remains. It turns out that most terminals (xterm |
8 |
and alikes, syscons in xterm mode) produce "\033[3~" by default so |
9 |
<Delete> has the expected effect. |
10 |
|
11 |
This also means that things need to be considerably misconfigured for |
12 |
<Backspace> to perform a <Delete> action. |
13 |
|
14 |
--- term.c 2007/06/10 19:06:09 170511 |
15 |
+++ term.c 2010/09/05 16:12:10 212235 |
16 |
@@ -223,7 +223,9 @@ |
17 |
{ "kh", "send cursor home" }, |
18 |
#define T_at7 37 |
19 |
{ "@7", "send cursor end" }, |
20 |
-#define T_str 38 |
21 |
+#define T_kD 38 |
22 |
+ { "kD", "send cursor delete" }, |
23 |
+#define T_str 39 |
24 |
{ NULL, NULL } |
25 |
}; |
26 |
|
27 |
@@ -1062,6 +1064,11 @@ |
28 |
arrow[A_K_EN].key = T_at7; |
29 |
arrow[A_K_EN].fun.cmd = ED_MOVE_TO_END; |
30 |
arrow[A_K_EN].type = XK_CMD; |
31 |
+ |
32 |
+ arrow[A_K_DE].name = "delete"; |
33 |
+ arrow[A_K_DE].key = T_kD; |
34 |
+ arrow[A_K_DE].fun.cmd = ED_DELETE_NEXT_CHAR; |
35 |
+ arrow[A_K_DE].type = XK_CMD; |
36 |
} |
37 |
|
38 |
|
39 |
--- term.h 2007/06/10 19:06:09 170511 |
40 |
+++ term.h 2010/09/05 16:12:10 212235 |
41 |
@@ -79,7 +79,8 @@ |
42 |
#define A_K_RT 3 |
43 |
#define A_K_HO 4 |
44 |
#define A_K_EN 5 |
45 |
-#define A_K_NKEYS 6 |
46 |
+#define A_K_DE 6 |
47 |
+#define A_K_NKEYS 7 |
48 |
|
49 |
protected void term_move_to_line(EditLine *, int); |
50 |
protected void term_move_to_char(EditLine *, int); |