mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 17:36:29 +00:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user