vim-patch:9.0.1245: code is indented more than necessary (#21998)

Problem:    Code is indented more than necessary.
Solution:   Use an early return where it makes sense. (Yegappan Lakshmanan,
            closes vim/vim#11879)

032713f829

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
zeertzjq
2023-01-26 08:52:21 +08:00
committed by GitHub
parent f15947866c
commit 88e906d165
5 changed files with 225 additions and 212 deletions

View File

@@ -736,22 +736,24 @@ void check_auto_format(bool end_insert)
int c = ' ';
int cc;
if (did_add_space) {
cc = gchar_cursor();
if (!WHITECHAR(cc)) {
// Somehow the space was removed already.
if (!did_add_space) {
return;
}
cc = gchar_cursor();
if (!WHITECHAR(cc)) {
// Somehow the space was removed already.
did_add_space = false;
} else {
if (!end_insert) {
inc_cursor();
c = gchar_cursor();
dec_cursor();
}
if (c != NUL) {
// The space is no longer at the end of the line, delete it.
del_char(false);
did_add_space = false;
} else {
if (!end_insert) {
inc_cursor();
c = gchar_cursor();
dec_cursor();
}
if (c != NUL) {
// The space is no longer at the end of the line, delete it.
del_char(false);
did_add_space = false;
}
}
}
}