[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH 02/10] vi: 'G'/'M' commands move to first visible character
From:       Ron Yorston <rmy () pobox ! com>
Date:       2021-03-28 12:19:26
Message-ID: 6060744e.6UoSSbtJWscLfo0x%rmy () pobox ! com
[Download RAW message or body]

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>
---
 editors/vi.c | 2 ++
 1 file changed, 2 insertions(+)

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)
 		if (cmdcnt > 0) {
 			dot = find_line(cmdcnt);	// what line is #cmdcnt
 		}
+		dot_begin();
 		dot_skip_over_ws();
 		break;
 	case 'H':			// H- goto top line on screen
@@ -3652,6 +3653,7 @@ static void do_cmd(int c)
 		dot = screenbegin;
 		for (cnt = 0; cnt < (rows-1) / 2; cnt++)
 			dot = next_line(dot);
+		dot_skip_over_ws();
 		break;
 	case 'O':			// O- open a empty line above
 		//    0i\n ESC -i
-- 
2.30.2

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic