diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-01-12 21:33:38 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-12 21:33:38 +0800 |
commit | a5f4ba74472f965953f0d3e45704c93b95f9b9a7 (patch) | |
tree | 2e839aa80db9ed9f5842a42a41223dfc2175fb1e /src | |
parent | 2aabe9b85870912b9eb8fe2ced0c21544de66f58 (diff) | |
download | rneovim-a5f4ba74472f965953f0d3e45704c93b95f9b9a7.tar.gz rneovim-a5f4ba74472f965953f0d3e45704c93b95f9b9a7.tar.bz2 rneovim-a5f4ba74472f965953f0d3e45704c93b95f9b9a7.zip |
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 <yegappan@yahoo.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/indent.c | 12 |
1 files changed, 7 insertions, 5 deletions
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 } } |