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

View File

@@ -1396,12 +1396,14 @@ void fixthisline(IndentGetter get_the_indent)
{ {
int amount = get_the_indent(); int amount = get_the_indent();
if (amount >= 0) { if (amount < 0) {
return;
}
change_indent(INDENT_SET, amount, false, 0, true); change_indent(INDENT_SET, amount, false, 0, true);
if (linewhite(curwin->w_cursor.lnum)) { if (linewhite(curwin->w_cursor.lnum)) {
did_ai = true; // delete the indent if the line stays empty did_ai = true; // delete the indent if the line stays empty
} }
}
} }
/// Return true if 'indentexpr' should be used for Lisp indenting. /// Return true if 'indentexpr' should be used for Lisp indenting.