diff options
author | jilles <jilles@FreeBSD.org> | 2010-09-05 16:12:10 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2010-09-05 16:12:10 +0000 |
commit | ac49a0b859fa53c2b6b8c042fb593220a78bd64d (patch) | |
tree | a28bf0f7968971f4feb592507e09591385af1ce1 /lib/libedit | |
parent | 4aee566266a24c6ba200a9feb5743c7a2d51137a (diff) | |
download | FreeBSD-src-ac49a0b859fa53c2b6b8c042fb593220a78bd64d.zip FreeBSD-src-ac49a0b859fa53c2b6b8c042fb593220a78bd64d.tar.gz |
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.
Diffstat (limited to 'lib/libedit')
-rw-r--r-- | lib/libedit/term.c | 9 | ||||
-rw-r--r-- | lib/libedit/term.h | 3 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/libedit/term.c b/lib/libedit/term.c index cffad07..1d89279 100644 --- a/lib/libedit/term.c +++ b/lib/libedit/term.c @@ -223,7 +223,9 @@ private const struct termcapstr { { "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 @@ term_init_arrow(EditLine *el) 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; } diff --git a/lib/libedit/term.h b/lib/libedit/term.h index 8ded5d7..15d393c 100644 --- a/lib/libedit/term.h +++ b/lib/libedit/term.h @@ -79,7 +79,8 @@ typedef struct { #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); |