diff options
author | Ron Yorston | 2021-04-30 12:56:12 +0100 |
---|---|---|
committer | Denys Vlasenko | 2021-05-04 14:51:48 +0200 |
commit | 24effc7a3f32b3d4e78779473ddc683848ac3cb0 (patch) | |
tree | f4f6285079cc73f641ed217015689d1894705dd1 /shell/hush_test/hush-redir/redir1.tests | |
parent | 147ac93a065e215545488337efbaa6dceebc04d0 (diff) | |
download | busybox-24effc7a3f32b3d4e78779473ddc683848ac3cb0.zip busybox-24effc7a3f32b3d4e78779473ddc683848ac3cb0.tar.gz |
vi: cursor positioning after whole-line 'y'
The 'y' command to yank text should leave the cursor at the start
of the range. This mostly works correctly in BusyBox vi but not
for whole-line yanks with backward motion, e.g. '2yk' to yank two
lines backwards. In this case the cursor is left at the end of the
range.
Fix this by returning the actual range from find_range(). Cursor
positioning following whole-line deletion is inconsistent between
vim and traditional vi. For BusyBox vi chose the option that uses
least code without being exactly compatible with either.
Also, find_range() preserved the value of 'dot', the current cursor
position. Since this isn't used by either caller of find_range()
we can save a few bytes by not bothering.
function old new delta
do_cmd 4730 4759 +29
find_range 749 686 -63
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 29/-63) Total: -34 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush_test/hush-redir/redir1.tests')
0 files changed, 0 insertions, 0 deletions