- Sync with NetBSD upstream

PR:		166435
Submitted by:	Pedro Giffuni <giffunip@tutopia.com>
This commit is contained in:
Martin Wilke 2012-04-11 03:08:27 +00:00
parent fd53d45a11
commit 5d8a59d2eb
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=294589
3 changed files with 80 additions and 1 deletions

View file

@ -7,7 +7,7 @@
PORTNAME= libedit
PORTVERSION= 2.6.10
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= devel
MASTER_SITES= ftp://ftp.astron.com/pub/libedit/ \
http://www.canonware.com/download/libedit/

View file

@ -0,0 +1,29 @@
Revision 212191
libedit: Do not move the cursor for ed-delete-next-char in emacs mode.
This makes ed-delete-next-char suitable for mapping to the <Delete> key.
Behaviour in vi mode is unchanged (for 'x').
--- common.c 2007/03/11 18:30:22 167457
+++ common.c 2010/09/03 22:24:26 212191
@@ -163,15 +163,12 @@
return (CC_ERROR);
#endif
}
- } else {
- if (el->el_line.cursor != el->el_line.buffer)
- el->el_line.cursor--;
- else
- return (CC_ERROR);
- }
+ } else
+ return (CC_ERROR);
}
c_delafter(el, el->el_state.argument); /* delete after dot */
- if (el->el_line.cursor >= el->el_line.lastchar &&
+ if (el->el_map.type == MAP_VI &&
+ el->el_line.cursor >= el->el_line.lastchar &&
el->el_line.cursor > el->el_line.buffer)
/* bounds check */
el->el_line.cursor = el->el_line.lastchar - 1;

View file

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