summaryrefslogtreecommitdiffstats
path: root/lib/libedit/common.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2010-09-03 22:24:26 +0000
committerjilles <jilles@FreeBSD.org>2010-09-03 22:24:26 +0000
commit4b5750a69a283c2576e48edded1d054bb02c2e25 (patch)
tree332ffae08a8212bcd4b2e8c87208d9f24caf3bfc /lib/libedit/common.c
parent642c71cb5d80533e263258f0efbc371e7cc02f5a (diff)
downloadFreeBSD-src-4b5750a69a283c2576e48edded1d054bb02c2e25.zip
FreeBSD-src-4b5750a69a283c2576e48edded1d054bb02c2e25.tar.gz
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').
Diffstat (limited to 'lib/libedit/common.c')
-rw-r--r--lib/libedit/common.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/libedit/common.c b/lib/libedit/common.c
index d4a9fa3..d314eef 100644
--- a/lib/libedit/common.c
+++ b/lib/libedit/common.c
@@ -163,15 +163,12 @@ ed_delete_next_char(EditLine *el, int c)
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;
OpenPOWER on IntegriCloud