aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-07-07 09:23:30 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2021-07-13 13:32:13 +0200
commitb50ac07cba558c370be66226ae0ad762157ee59a (patch)
tree2e5dbe1d749c7eccc2b4f23a9d2cda03e7f448b8
parentab755e3717cefc06fd28ce8db56f0402412afaa3 (diff)
downloadbusybox-w32-b50ac07cba558c370be66226ae0ad762157ee59a.tar.gz
busybox-w32-b50ac07cba558c370be66226ae0ad762157ee59a.tar.bz2
busybox-w32-b50ac07cba558c370be66226ae0ad762157ee59a.zip
vi: allow 'gg' to specify a range
Commit 7b93e317c (vi: enable 'dG' command. Closes 11801) allowed 'G' to be used as a range specifier for change/yank/delete operations. Add similar support for 'gg'. This requires setting the 'cmd_error' flag if 'g' is followed by any character other than another 'g'. function old new delta do_cmd 4852 4860 +8 .rodata 108179 108180 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 9/0) Total: 9 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--editors/vi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/editors/vi.c b/editors/vi.c
index f0bbc9518..22b8f7cf1 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -3437,7 +3437,7 @@ static int find_range(char **start, char **stop, int cmd)
3437 // for non-change operations WS after NL is not part of word 3437 // for non-change operations WS after NL is not part of word
3438 if (cmd != 'c' && dot != t && *dot != '\n') 3438 if (cmd != 'c' && dot != t && *dot != '\n')
3439 dot = t; 3439 dot = t;
3440 } else if (strchr("GHL+-jk'\r\n", c)) { 3440 } else if (strchr("GHL+-gjk'\r\n", c)) {
3441 // these operate on whole lines 3441 // these operate on whole lines
3442 buftype = WHOLE; 3442 buftype = WHOLE;
3443 do_cmd(c); // execute movement cmd 3443 do_cmd(c); // execute movement cmd
@@ -4027,6 +4027,7 @@ static void do_cmd(int c)
4027 buf[1] = (c1 >= 0 ? c1 : '*'); 4027 buf[1] = (c1 >= 0 ? c1 : '*');
4028 buf[2] = '\0'; 4028 buf[2] = '\0';
4029 not_implemented(buf); 4029 not_implemented(buf);
4030 cmd_error = TRUE;
4030 break; 4031 break;
4031 } 4032 }
4032 if (cmdcnt == 0) 4033 if (cmdcnt == 0)