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>
This commit is contained in:
Ron Yorston 2021-08-20 08:25:07 +01:00 committed by Denys Vlasenko
parent f9217cd235
commit 38e9c8c95b

View File

@ -4092,8 +4092,8 @@ static void do_cmd(int c)
#endif
}
}
} else /* if (c == '>') */ {
// shift right -- add tab or tabstop spaces
} else if (/* c == '>' && */ p != end_line(p)) {
// shift right -- add tab or tabstop spaces on non-empty lines
char_insert(p, '\t', allow_undo);
}
#if ENABLE_FEATURE_VI_UNDO