View | Details | Raw Unified | Return to bug 166435
Collapse All | Expand All

(-)libedit/files/patch-common.c (+29 lines)
Line 0 Link Here
1
Revision 212191
2
libedit: Do not move the cursor for ed-delete-next-char in emacs mode.
3
4
This makes ed-delete-next-char suitable for mapping to the <Delete> key.
5
6
Behaviour in vi mode is unchanged (for 'x').
7
8
--- common.c	2007/03/11 18:30:22	167457
9
+++ common.c	2010/09/03 22:24:26	212191
10
@@ -163,15 +163,12 @@
11
 				return (CC_ERROR);
12
 #endif
13
 			}
14
-		} else {
15
-			if (el->el_line.cursor != el->el_line.buffer)
16
-				el->el_line.cursor--;
17
-			else
18
-				return (CC_ERROR);
19
-		}
20
+		} else
21
+			return (CC_ERROR);
22
 	}
23
 	c_delafter(el, el->el_state.argument);	/* delete after dot */
24
-	if (el->el_line.cursor >= el->el_line.lastchar &&
25
+	if (el->el_map.type == MAP_VI &&
26
+	    el->el_line.cursor >= el->el_line.lastchar &&
27
 	    el->el_line.cursor > el->el_line.buffer)
28
 			/* bounds check */
29
 		el->el_line.cursor = el->el_line.lastchar - 1;
(-)libedit/files/patch-terminal (+50 lines)
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);

Return to bug 166435