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

View File

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

View File

@ -1475,7 +1475,7 @@ int op_delete(oparg_T *oap)
return FAIL;
if (curbuf->b_p_ai) { /* don't delete indent */
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;
} else
beginline(0); /* cursor in column 0 */