aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2015-03-12 21:15:34 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2015-03-12 21:15:34 +0100
commit49acc1a7618a28d34381cbb7661d7c981fcb238f (patch)
tree2db80507928e5da140e15c7a8f2b06d1ae84f0c4
parent8ec1ff350c28ae691ee80a001c7786f4ad8abe47 (diff)
downloadbusybox-w32-49acc1a7618a28d34381cbb7661d7c981fcb238f.tar.gz
busybox-w32-49acc1a7618a28d34381cbb7661d7c981fcb238f.tar.bz2
busybox-w32-49acc1a7618a28d34381cbb7661d7c981fcb238f.zip
vi: make BACKSPACE and DELETE join lines at start/end of line
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--editors/vi.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 77535be92..495332a46 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'
2017 p--; 2017 p--;
2018 } 2018 }
2019 } else if (c == erase_char || c == 8 || c == 127) { // Is this a BS 2019 } else if (c == erase_char || c == 8 || c == 127) { // Is this a BS
2020 // 123456789 2020 if (p > text) {
2021 if ((p[-1] != '\n') && (dot>text)) {
2022 p--; 2021 p--;
2023 p = text_hole_delete(p, p, ALLOW_UNDO_QUEUED); // shrink buffer 1 char 2022 p = text_hole_delete(p, p, ALLOW_UNDO_QUEUED); // shrink buffer 1 char
2024 } 2023 }
@@ -4026,8 +4025,9 @@ static void do_cmd(int c)
4026 undo_queue_commit(); 4025 undo_queue_commit();
4027 break; 4026 break;
4028 case KEYCODE_DELETE: 4027 case KEYCODE_DELETE:
4029 c = 'x'; 4028 if (dot < end - 1)
4030 // fall through 4029 dot = yank_delete(dot, dot, 1, YANKDEL, ALLOW_UNDO);
4030 break;
4031 case 'X': // X- delete char before dot 4031 case 'X': // X- delete char before dot
4032 case 'x': // x- delete the current char 4032 case 'x': // x- delete the current char
4033 case 's': // s- substitute the current char 4033 case 's': // s- substitute the current char