[git commit] vi: make BACKSPACE and DELETE join lines at start/end of line

Denys Vlasenko vda.linux at googlemail.com
Thu Mar 12 20:15:34 UTC 2015


commit: http://git.busybox.net/busybox/commit/?id=49acc1a7618a28d34381cbb7661d7c981fcb238f
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 editors/vi.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/editors/vi.c b/editors/vi.c
index 77535be..495332a 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -2017,8 +2017,7 @@ static char *char_insert(char *p, char c, int undo) // insert the char c at 'p'
 			p--;
 		}
 	} else if (c == erase_char || c == 8 || c == 127) { // Is this a BS
-		//     123456789
-		if ((p[-1] != '\n') && (dot>text)) {
+		if (p > text) {
 			p--;
 			p = text_hole_delete(p, p, ALLOW_UNDO_QUEUED);	// shrink buffer 1 char
 		}
@@ -4026,8 +4025,9 @@ static void do_cmd(int c)
 		undo_queue_commit();
 		break;
 	case KEYCODE_DELETE:
-		c = 'x';
-		// fall through
+		if (dot < end - 1)
+			dot = yank_delete(dot, dot, 1, YANKDEL, ALLOW_UNDO);
+		break;
 	case 'X':			// X- delete char before dot
 	case 'x':			// x- delete the current char
 	case 's':			// s- substitute the current char


More information about the busybox-cvs mailing list