edit: did_add_space is bool

This commit is contained in:
Jan Edmund Lazo
2018-08-07 13:16:38 -04:00
parent 672449e448
commit a2eff8f15c

View File

@@ -240,8 +240,8 @@ static int ins_need_undo; /* call u_save() before inserting a
char. Set when edit() is called. char. Set when edit() is called.
after that arrow_used is used. */ after that arrow_used is used. */
static int did_add_space = FALSE; /* auto_format() added an extra space static bool did_add_space = false; // auto_format() added an extra space
under the cursor */ // under the cursor
static TriState dont_sync_undo = kFalse; // CTRL-G U prevents syncing undo static TriState dont_sync_undo = kFalse; // CTRL-G U prevents syncing undo
// for the next left/right cursor // for the next left/right cursor
@@ -5772,10 +5772,11 @@ auto_format (
pnew[len + 1] = NUL; pnew[len + 1] = NUL;
ml_replace(curwin->w_cursor.lnum, pnew, false); ml_replace(curwin->w_cursor.lnum, pnew, false);
// remove the space later // remove the space later
did_add_space = TRUE; did_add_space = true;
} else } else {
/* may remove added space */ // may remove added space
check_auto_format(FALSE); check_auto_format(FALSE);
}
} }
check_cursor(); check_cursor();
@@ -5796,19 +5797,19 @@ check_auto_format (
if (did_add_space) { if (did_add_space) {
cc = gchar_cursor(); cc = gchar_cursor();
if (!WHITECHAR(cc)) if (!WHITECHAR(cc)) {
/* Somehow the space was removed already. */ // Somehow the space was removed already.
did_add_space = FALSE; did_add_space = false;
else { } else {
if (!end_insert) { if (!end_insert) {
inc_cursor(); inc_cursor();
c = gchar_cursor(); c = gchar_cursor();
dec_cursor(); dec_cursor();
} }
if (c != NUL) { if (c != NUL) {
/* The space is no longer at the end of the line, delete it. */ // The space is no longer at the end of the line, delete it.
del_char(FALSE); del_char(FALSE);
did_add_space = FALSE; did_add_space = false;
} }
} }
} }