aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-03-28 13:19:26 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2021-03-29 12:16:21 +0200
commit18871c3f2b96e76269f5c5e4bbf102808b69bd42 (patch)
tree432d5bb2e4f7a6ec9d8c0248908db915dff5a8bb
parent5ae25f40bdc839e3fb24dcb7ddd6067698bf87b0 (diff)
downloadbusybox-w32-18871c3f2b96e76269f5c5e4bbf102808b69bd42.tar.gz
busybox-w32-18871c3f2b96e76269f5c5e4bbf102808b69bd42.tar.bz2
busybox-w32-18871c3f2b96e76269f5c5e4bbf102808b69bd42.zip
vi: 'G'/'M' commands move to first visible character
The 'G' command with no target (meaning 'go to last line') should position the cursor on the first visible character of the line, as it already does in other cases. The 'M' command should position the cursor on the first visible character (as 'H' and 'L' already do). function old new delta do_cmd 4842 4853 +11 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 11/0) Total: 11 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--editors/vi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 47b13b3ca..f4da38071 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -3596,6 +3596,7 @@ static void do_cmd(int c)
3596 if (cmdcnt > 0) { 3596 if (cmdcnt > 0) {
3597 dot = find_line(cmdcnt); // what line is #cmdcnt 3597 dot = find_line(cmdcnt); // what line is #cmdcnt
3598 } 3598 }
3599 dot_begin();
3599 dot_skip_over_ws(); 3600 dot_skip_over_ws();
3600 break; 3601 break;
3601 case 'H': // H- goto top line on screen 3602 case 'H': // H- goto top line on screen
@@ -3652,6 +3653,7 @@ static void do_cmd(int c)
3652 dot = screenbegin; 3653 dot = screenbegin;
3653 for (cnt = 0; cnt < (rows-1) / 2; cnt++) 3654 for (cnt = 0; cnt < (rows-1) / 2; cnt++)
3654 dot = next_line(dot); 3655 dot = next_line(dot);
3656 dot_skip_over_ws();
3655 break; 3657 break;
3656 case 'O': // O- open a empty line above 3658 case 'O': // O- open a empty line above
3657 // 0i\n ESC -i 3659 // 0i\n ESC -i