globals: did_ai is bool

This commit is contained in:
Jan Edmund Lazo
2018-08-06 11:46:46 -04:00
parent b9ab363636
commit 47d52e1578
4 changed files with 17 additions and 15 deletions

View File

@@ -4456,7 +4456,7 @@ static int ins_complete(int c, bool enable_pum)
int save_w_wrow; int save_w_wrow;
int save_w_leftcol; int save_w_leftcol;
int insert_match; int insert_match;
int save_did_ai = did_ai; const bool save_did_ai = did_ai;
compl_direction = ins_compl_key2dir(c); compl_direction = ins_compl_key2dir(c);
insert_match = ins_compl_use_match(c); insert_match = ins_compl_use_match(c);
@@ -4464,7 +4464,7 @@ static int ins_complete(int c, bool enable_pum)
if (!compl_started) { if (!compl_started) {
/* First time we hit ^N or ^P (in a row, I mean) */ /* First time we hit ^N or ^P (in a row, I mean) */
did_ai = FALSE; did_ai = false;
did_si = false; did_si = false;
can_si = false; can_si = false;
can_si_back = false; can_si_back = false;
@@ -5270,7 +5270,7 @@ insertchar (
} }
end_comment_pending = NUL; end_comment_pending = NUL;
did_ai = FALSE; did_ai = false;
did_si = false; did_si = false;
can_si = false; can_si = false;
can_si_back = false; can_si_back = false;
@@ -5659,7 +5659,7 @@ internal_format (
haveto_redraw = true; haveto_redraw = true;
can_cindent = true; can_cindent = true;
// moved the cursor, don't autoindent or cindent now // moved the cursor, don't autoindent or cindent now
did_ai = FALSE; did_ai = false;
did_si = false; did_si = false;
can_si = false; can_si = false;
can_si_back = false; can_si_back = false;
@@ -6081,7 +6081,7 @@ stop_insert (
} }
} }
} }
did_ai = FALSE; did_ai = false;
did_si = false; did_si = false;
can_si = false; can_si = false;
can_si_back = false; can_si_back = false;
@@ -7464,8 +7464,9 @@ static void ins_shift(int c, int lastc)
} else } else
change_indent(c == Ctrl_D ? INDENT_DEC : INDENT_INC, 0, TRUE, 0, TRUE); change_indent(c == Ctrl_D ? INDENT_DEC : INDENT_INC, 0, TRUE, 0, TRUE);
if (did_ai && *skipwhite(get_cursor_line_ptr()) != NUL) if (did_ai && *skipwhite(get_cursor_line_ptr()) != NUL) {
did_ai = FALSE; did_ai = false;
}
did_si = false; did_si = false;
can_si = false; can_si = false;
can_si_back = false; can_si_back = false;
@@ -7489,7 +7490,7 @@ static void ins_del(void)
} else if (del_char(false) == FAIL) { // delete char under cursor } else if (del_char(false) == FAIL) { // delete char under cursor
vim_beep(BO_BS); vim_beep(BO_BS);
} }
did_ai = FALSE; did_ai = false;
did_si = false; did_si = false;
can_si = false; can_si = false;
can_si_back = false; can_si_back = false;
@@ -7659,7 +7660,7 @@ static bool ins_bs(int c, int mode, int *inserted_space_p)
State = oldState; State = oldState;
} }
} }
did_ai = FALSE; did_ai = false;
} else { } else {
/* /*
* Delete character(s) before the cursor. * Delete character(s) before the cursor.

View File

@@ -604,7 +604,7 @@ EXTERN pos_T where_paste_started;
* reset when any other editing is done on the line. If an <ESC> or <RETURN> * reset when any other editing is done on the line. If an <ESC> or <RETURN>
* is received, and did_ai is TRUE, the line is truncated. * is received, and did_ai is TRUE, the line is truncated.
*/ */
EXTERN int did_ai INIT(= FALSE); EXTERN bool did_ai INIT(= false);
/* /*
* Column of first char after autoindent. 0 when no autoindent done. Used * Column of first char after autoindent. 0 when no autoindent done. Used

View File

@@ -332,7 +332,7 @@ open_line (
can_si = true; can_si = true;
} }
did_ai = TRUE; did_ai = true;
} }
/* /*
@@ -710,8 +710,9 @@ open_line (
++less_cols_off; ++less_cols_off;
} }
} }
if (*p_extra != NUL) if (*p_extra != NUL) {
did_ai = FALSE; /* append some text, don't truncate now */ did_ai = false; // append some text, don't truncate now
}
/* columns for marks adjusted for removed columns */ /* columns for marks adjusted for removed columns */
less_cols = (int)(p_extra - saved_line); less_cols = (int)(p_extra - saved_line);
@@ -738,7 +739,7 @@ open_line (
} }
STRCAT(leader, p_extra); STRCAT(leader, p_extra);
p_extra = leader; p_extra = leader;
did_ai = TRUE; /* So truncating blanks works with comments */ did_ai = true; // So truncating blanks works with comments
less_cols -= lead_len; less_cols -= lead_len;
} else } else
end_comment_pending = NUL; /* turns out there was no leader */ end_comment_pending = NUL; /* turns out there was no leader */

View File

@@ -1475,7 +1475,7 @@ int op_delete(oparg_T *oap)
return FAIL; return FAIL;
if (curbuf->b_p_ai) { /* don't delete indent */ if (curbuf->b_p_ai) { /* don't delete indent */
beginline(BL_WHITE); /* cursor on first non-white */ beginline(BL_WHITE); /* cursor on first non-white */
did_ai = TRUE; /* delete the indent when ESC hit */ did_ai = true; // delete the indent when ESC hit
ai_col = curwin->w_cursor.col; ai_col = curwin->w_cursor.col;
} else } else
beginline(0); /* cursor in column 0 */ beginline(0); /* cursor in column 0 */