diff options
author | Ron Yorston <rmy@pobox.com> | 2021-08-20 08:25:07 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-08-20 15:26:09 +0200 |
commit | 38e9c8c95b919e949b1cdd16f05b648a75983f57 (patch) | |
tree | 0cac5abe4e6dd6a4ba18e5cd533ee4a58efd075f | |
parent | f9217cd235c2a139ae22cf549c7614724f1fc6cf (diff) | |
download | busybox-w32-38e9c8c95b919e949b1cdd16f05b648a75983f57.tar.gz busybox-w32-38e9c8c95b919e949b1cdd16f05b648a75983f57.tar.bz2 busybox-w32-38e9c8c95b919e949b1cdd16f05b648a75983f57.zip |
vi: don't right shift empty lines
The right shift command ('>') shouldn't affect empty lines.
function old new delta
do_cmd 4860 4894 +34
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 34/0) Total: 34 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | editors/vi.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/editors/vi.c b/editors/vi.c index e6527e36b..508477954 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -4092,8 +4092,8 @@ static void do_cmd(int c) | |||
4092 | #endif | 4092 | #endif |
4093 | } | 4093 | } |
4094 | } | 4094 | } |
4095 | } else /* if (c == '>') */ { | 4095 | } else if (/* c == '>' && */ p != end_line(p)) { |
4096 | // shift right -- add tab or tabstop spaces | 4096 | // shift right -- add tab or tabstop spaces on non-empty lines |
4097 | char_insert(p, '\t', allow_undo); | 4097 | char_insert(p, '\t', allow_undo); |
4098 | } | 4098 | } |
4099 | #if ENABLE_FEATURE_VI_UNDO | 4099 | #if ENABLE_FEATURE_VI_UNDO |