busybox/editors
Ron Yorston af3b585815 vi: fix regression in autoindent handling
Suppose autoindent is enabled and we have a line with an initial
tab where we want to split the words onto separate lines:

	split the words

One way to do this is with the sequence 'f r<CR>;r<CR>', but in
BusyBox vi the result is:

	split

	he
words

This is a regression introduced by commit 9659a8db1 (vi: remove
autoindent from otherwise empty lines).  The amount of indentation
is being recorded when the 'r' command inserts a newline but
isn't subsequently reset.  A fix is to only record the indent
when in insert or replace mode.  Proper handling of the 'o' and
'O' commands then requires them to switch to insert mode before
calling char_insert() to insert a newline.

function                                             old     new   delta
char_insert                                          884     891      +7
do_cmd                                              4243    4247      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 11/0)               Total: 11 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-06-26 19:38:28 +02:00
..
awk.c awk: input numbers are never octal or hex (only program consts can be) 2022-01-08 22:42:35 +01:00
cmp.c Add support for long options to cmp 2022-01-23 20:24:32 +01:00
Config.src restore documentation on the build config language 2018-06-06 15:16:48 +02:00
diff.c diff: code shrink 2021-02-22 19:00:07 +01:00
ed.c ed: add support for -s command-line option as mandated by POSIX 2021-12-29 19:01:32 +01:00
Kbuild.src switch editors/* to embedded-in-source kbuild system 2013-11-13 12:45:33 +01:00
patch_bbox.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
patch_toybox.c libbb: shrink lineedit_read_key() 2022-01-18 00:36:42 +01:00
patch.c libbb: shrink lineedit_read_key() 2022-01-18 00:36:42 +01:00
sed_summary.htm doc: add info about sed s/.../.../I modifier 2008-03-01 19:29:56 +00:00
sed.c sed: fix handling of escaped delimiters in s/// replacement 2022-01-23 19:04:27 +01:00
sed1line.txt add sed mini-doc 2007-11-13 17:13:31 +00:00
vi.c vi: fix regression in autoindent handling 2022-06-26 19:38:28 +02:00