aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-04-15 12:03:22 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2021-04-15 13:09:12 +0200
commitd6e653d667bc1eb343014508a8bddb3dd4945f78 (patch)
treec628220816cde751484d83c9b5773fe504243f58
parent38ae0f3e3e9490c5b8cc3b917c2d896404afddbe (diff)
downloadbusybox-w32-d6e653d667bc1eb343014508a8bddb3dd4945f78.tar.gz
busybox-w32-d6e653d667bc1eb343014508a8bddb3dd4945f78.tar.bz2
busybox-w32-d6e653d667bc1eb343014508a8bddb3dd4945f78.zip
vi: don't move cursor when yanking whole lines
When whole lines are yanked using 'yy' or 'Y' vi doesn't change the cursor position. Make BusyBox vi do the same. function old new delta do_cmd 4776 4786 +10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 10/0) Total: 10 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--editors/vi.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/editors/vi.c b/editors/vi.c
index d20481fbd..780c81234 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -3934,6 +3934,7 @@ static void do_cmd(int c)
3934# endif 3934# endif
3935 if (c == 'y' || c == 'Y') 3935 if (c == 'y' || c == 'Y')
3936 yf = YANKONLY; 3936 yf = YANKONLY;
3937 save_dot = dot;
3937#endif 3938#endif
3938 // determine range, and whether it spans lines 3939 // determine range, and whether it spans lines
3939 buftype = find_range(&p, &q, c); 3940 buftype = find_range(&p, &q, c);
@@ -3951,6 +3952,11 @@ static void do_cmd(int c)
3951 dot_begin(); 3952 dot_begin();
3952 dot_skip_over_ws(); 3953 dot_skip_over_ws();
3953 } 3954 }
3955#if ENABLE_FEATURE_VI_YANKMARK
3956 else /* (c == 'y' || c == 'Y') */ {
3957 dot = save_dot;
3958 }
3959#endif
3954 } 3960 }
3955 // if CHANGING, not deleting, start inserting after the delete 3961 // if CHANGING, not deleting, start inserting after the delete
3956 if (c == 'c') { 3962 if (c == 'c') {