From a5f4ba74472f965953f0d3e45704c93b95f9b9a7 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 12 Jan 2023 21:33:38 +0800 Subject: 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) https://github.com/vim/vim/commit/0233bdfa2b487c392dc4fd1a29113e08fbace334 Co-authored-by: Yegappan Lakshmanan --- src/nvim/indent.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/nvim/indent.c b/src/nvim/indent.c index 7d3b1f4a3f..27d6f60011 100644 --- a/src/nvim/indent.c +++ b/src/nvim/indent.c @@ -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 } } -- cgit