vim-patch:9.0.1183: code is indented more than necessary (#21773)

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

0233bdfa2b

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
zeertzjq 2023-01-12 21:33:38 +08:00 committed by GitHub
parent 2aabe9b858
commit a5f4ba7447
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1396,11 +1396,13 @@ void fixthisline(IndentGetter get_the_indent)
{
int amount = get_the_indent();
if (amount >= 0) {
change_indent(INDENT_SET, amount, false, 0, true);
if (linewhite(curwin->w_cursor.lnum)) {
did_ai = true; // delete the indent if the line stays empty
}
if (amount < 0) {
return;
}
change_indent(INDENT_SET, amount, false, 0, true);
if (linewhite(curwin->w_cursor.lnum)) {
did_ai = true; // delete the indent if the line stays empty
}
}