diff options
author | Ron Yorston <rmy@pobox.com> | 2021-05-20 08:27:48 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-06-02 06:29:34 +0200 |
commit | 9659a8db1dd28bdf8659fdae5d097b6f48bd2736 (patch) | |
tree | 7a984a8efdadb26fad56ef6cdcd0b5da7ef14808 /console-tools/clear.c | |
parent | 16e2fa9049d5ddd7d4c8aea875dad91e07868685 (diff) |
vi: remove autoindent from otherwise empty lines
Lines that have no content apart from automatic indentation should
be treated as empty when the user hits return or ESC.
The implementation uses the global variable 'indentcol'. Usually
this is zero. It can also be -1 to indicate an 'O' (open above)
command, replacing the overloading of the tabstop option bit.
A value greater than zero indicates that the current line has
been autoindented to the given column (or that the autoindent has
been adjusted with ctrl-D). Any other change to the line resets
'indentcol' to zero.
Replace strspn() with ident_len(). The latter handles the unlikely
case that it's called on the last line of a file which doesn't have
a terminating newline.
function old new delta
char_insert 741 912 +171
indent_len - 42 +42
do_cmd 4781 4785 +4
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/0 up/down: 217/0) Total: 217 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'console-tools/clear.c')
0 files changed, 0 insertions, 0 deletions