refactor: replace TRUE/FALSE with true/false #15647

This commit is contained in:
dundargoc 2021-09-13 13:57:36 +02:00 committed by GitHub
parent b9d57fa107
commit d5b66e8860
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 150 additions and 165 deletions

View File

@ -174,8 +174,7 @@ static int compl_enter_selects = FALSE;
* are used. */ * are used. */
static char_u *compl_leader = NULL; static char_u *compl_leader = NULL;
static int compl_get_longest = FALSE; /* put longest common string static bool compl_get_longest = false; // put longest common string in compl_leader
in compl_leader */
static int compl_no_insert = FALSE; /* FALSE: select & insert static int compl_no_insert = FALSE; /* FALSE: select & insert
TRUE: noinsert */ TRUE: noinsert */
@ -211,7 +210,7 @@ static char_u *compl_orig_text = NULL; /* text as it was before
static int compl_cont_mode = 0; static int compl_cont_mode = 0;
static expand_T compl_xp; static expand_T compl_xp;
static int compl_opt_refresh_always = FALSE; static bool compl_opt_refresh_always = false;
static int pum_selected_item = -1; static int pum_selected_item = -1;
@ -4110,7 +4109,7 @@ static int ins_compl_get_exp(pos_T *ini)
static pos_T first_match_pos; static pos_T first_match_pos;
static pos_T last_match_pos; static pos_T last_match_pos;
static char_u *e_cpt = (char_u *)""; // curr. entry in 'complete' static char_u *e_cpt = (char_u *)""; // curr. entry in 'complete'
static int found_all = false; // Found all matches of a static bool found_all = false; // Found all matches of a
// certain type. // certain type.
static buf_T *ins_buf = NULL; // buffer being scanned static buf_T *ins_buf = NULL; // buffer being scanned
@ -4127,7 +4126,7 @@ static int ins_compl_get_exp(pos_T *ini)
char_u *ptr; char_u *ptr;
char_u *dict = NULL; char_u *dict = NULL;
int dict_f = 0; int dict_f = 0;
int set_match_pos; bool set_match_pos;
int l_ctrl_x_mode = ctrl_x_mode; int l_ctrl_x_mode = ctrl_x_mode;
assert(curbuf != NULL); assert(curbuf != NULL);
@ -4136,7 +4135,7 @@ static int ins_compl_get_exp(pos_T *ini)
FOR_ALL_BUFFERS(buf) { FOR_ALL_BUFFERS(buf) {
buf->b_scanned = false; buf->b_scanned = false;
} }
found_all = FALSE; found_all = false;
ins_buf = curbuf; ins_buf = curbuf;
e_cpt = (compl_cont_status & CONT_LOCAL) e_cpt = (compl_cont_status & CONT_LOCAL)
? (char_u *)"." : curbuf->b_p_cpt; ? (char_u *)"." : curbuf->b_p_cpt;
@ -4151,7 +4150,7 @@ static int ins_compl_get_exp(pos_T *ini)
// For ^N/^P loop over all the flags/windows/buffers in 'complete' // For ^N/^P loop over all the flags/windows/buffers in 'complete'
for (;; ) { for (;; ) {
found_new_match = FAIL; found_new_match = FAIL;
set_match_pos = FALSE; set_match_pos = false;
assert(l_ctrl_x_mode == ctrl_x_mode); assert(l_ctrl_x_mode == ctrl_x_mode);
@ -4161,7 +4160,7 @@ static int ins_compl_get_exp(pos_T *ini)
if ((l_ctrl_x_mode == CTRL_X_NORMAL if ((l_ctrl_x_mode == CTRL_X_NORMAL
|| CTRL_X_MODE_LINE_OR_EVAL(l_ctrl_x_mode)) || CTRL_X_MODE_LINE_OR_EVAL(l_ctrl_x_mode))
&& (!compl_started || found_all)) { && (!compl_started || found_all)) {
found_all = FALSE; found_all = false;
while (*e_cpt == ',' || *e_cpt == ' ') { while (*e_cpt == ',' || *e_cpt == ' ') {
e_cpt++; e_cpt++;
} }
@ -4241,7 +4240,7 @@ static int ins_compl_get_exp(pos_T *ini)
// in any case e_cpt is advanced to the next entry // in any case e_cpt is advanced to the next entry
(void)copy_option_part(&e_cpt, IObuff, IOSIZE, ","); (void)copy_option_part(&e_cpt, IObuff, IOSIZE, ",");
found_all = TRUE; found_all = true;
if (type == -1) { if (type == -1) {
continue; continue;
} }
@ -4397,7 +4396,7 @@ static int ins_compl_get_exp(pos_T *ini)
} }
if (found_new_match == FAIL) { if (found_new_match == FAIL) {
if (ins_buf == curbuf) { if (ins_buf == curbuf) {
found_all = TRUE; found_all = true;
} }
break; break;
} }
@ -5247,11 +5246,9 @@ static int ins_complete(int c, bool enable_pum)
return FAIL; return FAIL;
} }
/* // Reset extended parameters of completion, when start new
* Reset extended parameters of completion, when start new // completion.
* completion. compl_opt_refresh_always = false;
*/
compl_opt_refresh_always = FALSE;
if (col < 0) { if (col < 0) {
col = curs_col; col = curs_col;
@ -5532,8 +5529,8 @@ int get_literal(void)
int cc; int cc;
int nc; int nc;
int i; int i;
int hex = FALSE; bool hex = false;
int octal = FALSE; bool octal = false;
int unicode = 0; int unicode = 0;
if (got_int) { if (got_int) {
@ -5550,9 +5547,9 @@ int get_literal(void)
add_to_showcmd(nc); add_to_showcmd(nc);
} }
if (nc == 'x' || nc == 'X') { if (nc == 'x' || nc == 'X') {
hex = TRUE; hex = true;
} else if (nc == 'o' || nc == 'O') { } else if (nc == 'o' || nc == 'O') {
octal = TRUE; octal = true;
} else if (nc == 'u' || nc == 'U') { } else if (nc == 'u' || nc == 'U') {
unicode = nc; unicode = nc;
} else { } else {
@ -6329,7 +6326,7 @@ void auto_format(bool trailblank, bool prev_line)
/* With the 'c' flag in 'formatoptions' and 't' missing: only format /* With the 'c' flag in 'formatoptions' and 't' missing: only format
* comments. */ * comments. */
if (has_format_option(FO_WRAP_COMS) && !has_format_option(FO_WRAP) if (has_format_option(FO_WRAP_COMS) && !has_format_option(FO_WRAP)
&& get_leader_len(old, NULL, FALSE, TRUE) == 0) { && get_leader_len(old, NULL, false, true) == 0) {
return; return;
} }
@ -6478,7 +6475,8 @@ static void start_arrow(pos_T *end_insert_pos)
} }
/// Like start_arrow() but with end_change argument. /// Like start_arrow() but with end_change argument.
/// Will prepare for redo of CTRL-G U if "end_change" is FALSE. /// Will prepare for redo of CTRL-G U if "end_change" is false.
///
/// @param end_insert_pos can be NULL /// @param end_insert_pos can be NULL
/// @param end_change end undoable change /// @param end_change end undoable change
static void start_arrow_with_change(pos_T *end_insert_pos, bool end_change) static void start_arrow_with_change(pos_T *end_insert_pos, bool end_change)
@ -6523,7 +6521,7 @@ static void check_spell_redraw(void)
static void spell_back_to_badword(void) static void spell_back_to_badword(void)
{ {
pos_T tpos = curwin->w_cursor; pos_T tpos = curwin->w_cursor;
spell_bad_len = spell_move_to(curwin, BACKWARD, TRUE, TRUE, NULL); spell_bad_len = spell_move_to(curwin, BACKWARD, true, true, NULL);
if (curwin->w_cursor.col != tpos.col) { if (curwin->w_cursor.col != tpos.col) {
start_arrow(&tpos); start_arrow(&tpos);
} }
@ -6541,7 +6539,7 @@ int stop_arrow(void)
if (Insstart.col > Insstart_orig.col && !ins_need_undo) { if (Insstart.col > Insstart_orig.col && !ins_need_undo) {
// Don't update the original insert position when moved to the // Don't update the original insert position when moved to the
// right, except when nothing was inserted yet. // right, except when nothing was inserted yet.
update_Insstart_orig = FALSE; update_Insstart_orig = false;
} }
Insstart_textlen = (colnr_T)linetabsize(get_cursor_line_ptr()); Insstart_textlen = (colnr_T)linetabsize(get_cursor_line_ptr());
@ -7383,7 +7381,7 @@ bool in_cinkeys(int keytyped, int when, bool line_is_empty)
int try_match_word; int try_match_word;
char_u *p; char_u *p;
char_u *line; char_u *line;
int icase; bool icase;
if (keytyped == NUL) { if (keytyped == NUL) {
// Can happen with CTRL-Y and CTRL-E on a short line. // Can happen with CTRL-Y and CTRL-E on a short line.
@ -7511,10 +7509,10 @@ bool in_cinkeys(int keytyped, int when, bool line_is_empty)
else if (*look == '=' && look[1] != ',' && look[1] != NUL) { else if (*look == '=' && look[1] != ',' && look[1] != NUL) {
++look; ++look;
if (*look == '~') { if (*look == '~') {
icase = TRUE; icase = true;
++look; look++;
} else { } else {
icase = FALSE; icase = false;
} }
p = vim_strchr(look, ','); p = vim_strchr(look, ',');
if (p == NULL) { if (p == NULL) {
@ -7671,7 +7669,7 @@ int hkmap(int c)
static void ins_reg(void) static void ins_reg(void)
{ {
int need_redraw = FALSE; bool need_redraw = false;
int regname; int regname;
int literally = 0; int literally = 0;
int vis_active = VIsual_active; int vis_active = VIsual_active;
@ -7783,14 +7781,14 @@ static void ins_ctrl_g(void)
case K_UP: case K_UP:
case Ctrl_K: case Ctrl_K:
case 'k': case 'k':
ins_up(TRUE); ins_up(true);
break; break;
// CTRL-G j and CTRL-G <Down>: cursor down to Insstart.col // CTRL-G j and CTRL-G <Down>: cursor down to Insstart.col
case K_DOWN: case K_DOWN:
case Ctrl_J: case Ctrl_J:
case 'j': case 'j':
ins_down(TRUE); ins_down(true);
break; break;
// CTRL-G u: start new undoable edit // CTRL-G u: start new undoable edit
@ -9229,7 +9227,7 @@ static void ins_try_si(int c)
pos_T *pos, old_pos; pos_T *pos, old_pos;
char_u *ptr; char_u *ptr;
int i; int i;
int temp; bool temp;
/* /*
* do some very smart indenting when entering '{' or '}' * do some very smart indenting when entering '{' or '}'
@ -9266,11 +9264,9 @@ static void ins_try_si(int c)
(void)set_indent(i, SIN_CHANGED); (void)set_indent(i, SIN_CHANGED);
} }
} else if (curwin->w_cursor.col > 0) { } else if (curwin->w_cursor.col > 0) {
/* // when inserting '{' after "O" reduce indent, but not
* when inserting '{' after "O" reduce indent, but not // more than indent of previous line
* more than indent of previous line temp = true;
*/
temp = TRUE;
if (c == '{' && can_si_back && curwin->w_cursor.lnum > 1) { if (c == '{' && can_si_back && curwin->w_cursor.lnum > 1) {
old_pos = curwin->w_cursor; old_pos = curwin->w_cursor;
i = get_indent(); i = get_indent();
@ -9283,7 +9279,7 @@ static void ins_try_si(int c)
} }
} }
if (get_indent() >= i) { if (get_indent() >= i) {
temp = FALSE; temp = false;
} }
curwin->w_cursor = old_pos; curwin->w_cursor = old_pos;
} }

View File

@ -1547,7 +1547,7 @@ call_func(
// Trigger FuncUndefined event, may load the function. // Trigger FuncUndefined event, may load the function.
if (fp == NULL if (fp == NULL
&& apply_autocmds(EVENT_FUNCUNDEFINED, rfname, rfname, TRUE, NULL) && apply_autocmds(EVENT_FUNCUNDEFINED, rfname, rfname, true, NULL)
&& !aborting()) { && !aborting()) {
// executed an autocommand, search for the function again // executed an autocommand, search for the function again
fp = find_func(rfname); fp = find_func(rfname);

View File

@ -740,7 +740,7 @@ void ex_retab(exarg_T *eap)
long old_len; long old_len;
char_u *ptr; char_u *ptr;
char_u *new_line = (char_u *)1; // init to non-NULL char_u *new_line = (char_u *)1; // init to non-NULL
int did_undo; // called u_save for current line bool did_undo; // called u_save for current line
long *new_vts_array = NULL; long *new_vts_array = NULL;
char_u *new_ts_str; // string value of tab argument char_u *new_ts_str; // string value of tab argument
@ -772,7 +772,7 @@ void ex_retab(exarg_T *eap)
ptr = ml_get(lnum); ptr = ml_get(lnum);
col = 0; col = 0;
vcol = 0; vcol = 0;
did_undo = FALSE; did_undo = false;
for (;; ) { for (;; ) {
if (ascii_iswhite(ptr[col])) { if (ascii_iswhite(ptr[col])) {
if (!got_tab && num_spaces == 0) { if (!got_tab && num_spaces == 0) {
@ -1240,7 +1240,7 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
/* Careful: This may recursively call do_bang() again! (because of /* Careful: This may recursively call do_bang() again! (because of
* autocommands) */ * autocommands) */
do_filter(line1, line2, eap, newcmd, do_in, do_out); do_filter(line1, line2, eap, newcmd, do_in, do_out);
apply_autocmds(EVENT_SHELLFILTERPOST, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_SHELLFILTERPOST, NULL, NULL, false, curbuf);
} }
if (free_newcmd) { if (free_newcmd) {
xfree(newcmd); xfree(newcmd);
@ -1519,7 +1519,7 @@ void do_shell(char_u *cmd, int flags)
msg_row = Rows - 1; msg_row = Rows - 1;
msg_col = 0; msg_col = 0;
apply_autocmds(EVENT_SHELLCMDPOST, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_SHELLCMDPOST, NULL, NULL, false, curbuf);
} }
#if !defined(UNIX) #if !defined(UNIX)
@ -1688,7 +1688,7 @@ int rename_buffer(char_u *new_fname)
buf_T *buf; buf_T *buf;
buf = curbuf; buf = curbuf;
apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, false, curbuf);
// buffer changed, don't change name now // buffer changed, don't change name now
if (buf != curbuf) { if (buf != curbuf) {
return FAIL; return FAIL;
@ -1722,7 +1722,7 @@ int rename_buffer(char_u *new_fname)
} }
xfree(fname); xfree(fname);
xfree(sfname); xfree(sfname);
apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, false, curbuf);
// Change directories when the 'acd' option is set. // Change directories when the 'acd' option is set.
do_autochdir(); do_autochdir();
return OK; return OK;
@ -1881,8 +1881,8 @@ int do_write(exarg_T *eap)
if (eap->cmdidx == CMD_saveas && alt_buf != NULL) { if (eap->cmdidx == CMD_saveas && alt_buf != NULL) {
buf_T *was_curbuf = curbuf; buf_T *was_curbuf = curbuf;
apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, false, curbuf);
apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, alt_buf); apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, false, alt_buf);
if (curbuf != was_curbuf || aborting()) { if (curbuf != was_curbuf || aborting()) {
// buffer changed, don't change name now // buffer changed, don't change name now
retval = FAIL; retval = FAIL;
@ -1903,8 +1903,8 @@ int do_write(exarg_T *eap)
alt_buf->b_sfname = curbuf->b_sfname; alt_buf->b_sfname = curbuf->b_sfname;
curbuf->b_sfname = fname; curbuf->b_sfname = fname;
buf_name_changed(curbuf); buf_name_changed(curbuf);
apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, false, curbuf);
apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, alt_buf); apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, false, alt_buf);
if (!alt_buf->b_p_bl) { if (!alt_buf->b_p_bl) {
alt_buf->b_p_bl = TRUE; alt_buf->b_p_bl = TRUE;
apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, alt_buf); apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, alt_buf);
@ -2287,12 +2287,12 @@ theend:
int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T newlnum, int flags, int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T newlnum, int flags,
win_T *oldwin) win_T *oldwin)
{ {
int other_file; // TRUE if editing another file bool other_file; // true if editing another file
int oldbuf; // TRUE if using existing buffer int oldbuf; // TRUE if using existing buffer
int auto_buf = FALSE; /* TRUE if autocommands brought us bool auto_buf = false; // true if autocommands brought us
into the buffer unexpectedly */ // into the buffer unexpectedly
char_u *new_name = NULL; char_u *new_name = NULL;
int did_set_swapcommand = FALSE; bool did_set_swapcommand = false;
buf_T *buf; buf_T *buf;
bufref_T bufref; bufref_T bufref;
bufref_T old_curbuf; bufref_T old_curbuf;
@ -2305,7 +2305,7 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
int solcol = -1; int solcol = -1;
pos_T *pos; pos_T *pos;
char_u *command = NULL; char_u *command = NULL;
int did_get_winopts = FALSE; bool did_get_winopts = false;
int readfile_flags = 0; int readfile_flags = 0;
bool did_inc_redrawing_disabled = false; bool did_inc_redrawing_disabled = false;
long *so_ptr = curwin->w_p_so >= 0 ? &curwin->w_p_so : &p_so; long *so_ptr = curwin->w_p_so >= 0 ? &curwin->w_p_so : &p_so;
@ -2320,7 +2320,7 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
if (fnum == curbuf->b_fnum) { // file is already being edited if (fnum == curbuf->b_fnum) { // file is already being edited
return OK; // nothing to do return OK; // nothing to do
} }
other_file = TRUE; other_file = true;
} else { } else {
// if no short name given, use ffname for short name // if no short name given, use ffname for short name
if (sfname == NULL) { if (sfname == NULL) {
@ -2338,11 +2338,9 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
} }
if (ffname == NULL) { if (ffname == NULL) {
other_file = TRUE; other_file = true;
} } else if (*ffname == NUL && curbuf->b_ffname == NULL) { // there is no file name
// there is no file name other_file = false;
else if (*ffname == NUL && curbuf->b_ffname == NULL) {
other_file = FALSE;
} else { } else {
if (*ffname == NUL) { // re-edit with same file name if (*ffname == NUL) { // re-edit with same file name
ffname = curbuf->b_ffname; ffname = curbuf->b_ffname;
@ -2397,7 +2395,7 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
vim_snprintf(p, len, "%" PRId64 "G", (int64_t)newlnum); vim_snprintf(p, len, "%" PRId64 "G", (int64_t)newlnum);
} }
set_vim_var_string(VV_SWAPCOMMAND, p, -1); set_vim_var_string(VV_SWAPCOMMAND, p, -1);
did_set_swapcommand = TRUE; did_set_swapcommand = true;
xfree(p); xfree(p);
} }
@ -2584,7 +2582,7 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
* before, reset the local window options to the global * before, reset the local window options to the global
* values. Also restores old folding stuff. */ * values. Also restores old folding stuff. */
get_winopts(curbuf); get_winopts(curbuf);
did_get_winopts = TRUE; did_get_winopts = true;
} }
xfree(new_name); xfree(new_name);
au_new_curbuf.br_buf = NULL; au_new_curbuf.br_buf = NULL;
@ -2836,17 +2834,17 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
msg_scroll = FALSE; msg_scroll = FALSE;
} }
if (!msg_scroll) { // wait a bit when overwriting an error msg if (!msg_scroll) { // wait a bit when overwriting an error msg
check_for_delay(FALSE); check_for_delay(false);
} }
msg_start(); msg_start();
msg_scroll = msg_scroll_save; msg_scroll = msg_scroll_save;
msg_scrolled_ign = TRUE; msg_scrolled_ign = true;
if (!shortmess(SHM_FILEINFO)) { if (!shortmess(SHM_FILEINFO)) {
fileinfo(false, true, false); fileinfo(false, true, false);
} }
msg_scrolled_ign = FALSE; msg_scrolled_ign = false;
} }
curbuf->b_last_used = time(NULL); curbuf->b_last_used = time(NULL);
@ -3459,8 +3457,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
int delimiter; int delimiter;
bool has_second_delim = false; bool has_second_delim = false;
int sublen; int sublen;
int got_quit = false; bool got_quit = false;
int got_match = false; bool got_match = false;
int which_pat; int which_pat;
char_u *cmd = eap->arg; char_u *cmd = eap->arg;
linenr_T first_line = 0; // first changed line linenr_T first_line = 0; // first changed line
@ -3650,7 +3648,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
colnr_T prev_matchcol = MAXCOL; colnr_T prev_matchcol = MAXCOL;
char_u *new_end, *new_start = NULL; char_u *new_end, *new_start = NULL;
char_u *p1; char_u *p1;
int did_sub = FALSE; bool did_sub = false;
int lastone; int lastone;
long nmatch_tl = 0; // nr of lines matched below lnum long nmatch_tl = 0; // nr of lines matched below lnum
int do_again; // do it again after joining lines int do_again; // do it again after joining lines
@ -3708,7 +3706,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
// At first match, remember current cursor position. // At first match, remember current cursor position.
if (!got_match) { if (!got_match) {
setpcmark(); setpcmark();
got_match = TRUE; got_match = true;
} }
/* /*
@ -3798,9 +3796,9 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
skip_match = true; skip_match = true;
} }
sub_nsubs++; sub_nsubs++;
did_sub = TRUE; did_sub = true;
/* Skip the substitution, unless an expression is used, // Skip the substitution, unless an expression is used,
* then it is evaluated in the sandbox. */ // then it is evaluated in the sandbox.
if (!(sub[0] == '\\' && sub[1] == '=')) { if (!(sub[0] == '\\' && sub[1] == '=')) {
goto skip; goto skip;
} }
@ -4435,7 +4433,7 @@ skip:
/// ///
/// @param count_only used 'n' flag for ":s" /// @param count_only used 'n' flag for ":s"
/// ///
/// @return TRUE if a message was given. /// @return true if a message was given.
bool do_sub_msg(bool count_only) bool do_sub_msg(bool count_only)
{ {
/* /*
@ -4683,7 +4681,7 @@ void free_old_sub(void)
/// ///
/// @param undo_sync sync undo when leaving the window /// @param undo_sync sync undo when leaving the window
/// ///
/// @return TRUE when it was created. /// @return true when it was created.
bool prepare_tagpreview(bool undo_sync) bool prepare_tagpreview(bool undo_sync)
{ {
/* /*

View File

@ -1456,7 +1456,7 @@ static char_u * do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineG
++p; ++p;
} }
p = vim_strnsave(ea.cmd, p - ea.cmd); p = vim_strnsave(ea.cmd, p - ea.cmd);
int ret = apply_autocmds(EVENT_CMDUNDEFINED, p, p, TRUE, NULL); int ret = apply_autocmds(EVENT_CMDUNDEFINED, p, p, true, NULL);
xfree(p); xfree(p);
// If the autocommands did something and didn't cause an error, try // If the autocommands did something and didn't cause an error, try
// finding the command again. // finding the command again.
@ -2702,12 +2702,12 @@ static char_u *find_ucmd(exarg_T *eap, char_u *p, int *full, expand_T *xp, int *
int len = (int)(p - eap->cmd); int len = (int)(p - eap->cmd);
int j, k, matchlen = 0; int j, k, matchlen = 0;
ucmd_T *uc; ucmd_T *uc;
int found = FALSE; bool found = false;
int possible = FALSE; bool possible = false;
char_u *cp, *np; // Point into typed cmd and test name char_u *cp, *np; // Point into typed cmd and test name
garray_T *gap; garray_T *gap;
int amb_local = FALSE; /* Found ambiguous buffer-local command, bool amb_local = false; // Found ambiguous buffer-local command,
only full match global is accepted. */ // only full match global is accepted.
/* /*
* Look for buffer-local user commands first, then global ones. * Look for buffer-local user commands first, then global ones.
@ -2730,7 +2730,7 @@ static char_u *find_ucmd(exarg_T *eap, char_u *p, int *full, expand_T *xp, int *
if (gap == &ucmds) { if (gap == &ucmds) {
return NULL; return NULL;
} }
amb_local = TRUE; amb_local = true;
} }
if (!found || (k == len && *np == NUL)) { if (!found || (k == len && *np == NUL)) {
@ -2739,9 +2739,9 @@ static char_u *find_ucmd(exarg_T *eap, char_u *p, int *full, expand_T *xp, int *
* should use instead. * should use instead.
*/ */
if (k == len) { if (k == len) {
found = TRUE; found = true;
} else { } else {
possible = TRUE; possible = true;
} }
if (gap == &ucmds) { if (gap == &ucmds) {
@ -2768,7 +2768,7 @@ static char_u *find_ucmd(exarg_T *eap, char_u *p, int *full, expand_T *xp, int *
if (full != NULL) { if (full != NULL) {
*full = TRUE; *full = TRUE;
} }
amb_local = FALSE; amb_local = false;
break; break;
} }
} }
@ -4511,8 +4511,7 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp)
*/ */
if (vim_strchr(eap->arg, '$') != NULL if (vim_strchr(eap->arg, '$') != NULL
|| vim_strchr(eap->arg, '~') != NULL) { || vim_strchr(eap->arg, '~') != NULL) {
expand_env_esc(eap->arg, NameBuff, MAXPATHL, expand_env_esc(eap->arg, NameBuff, MAXPATHL, true, true, NULL);
TRUE, TRUE, NULL);
has_wildcards = path_has_wildcard(NameBuff); has_wildcards = path_has_wildcard(NameBuff);
p = NameBuff; p = NameBuff;
} else { } else {
@ -7192,7 +7191,7 @@ void ex_splitview(exarg_T *eap)
if (win_new_tabpage(cmdmod.tab != 0 ? cmdmod.tab : eap->addr_count == 0 if (win_new_tabpage(cmdmod.tab != 0 ? cmdmod.tab : eap->addr_count == 0
? 0 : (int)eap->line2 + 1, eap->arg) != FAIL) { ? 0 : (int)eap->line2 + 1, eap->arg) != FAIL) {
do_exedit(eap, old_curwin); do_exedit(eap, old_curwin);
apply_autocmds(EVENT_TABNEWENTERED, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_TABNEWENTERED, NULL, NULL, false, curbuf);
// set the alternate buffer for the window we came from // set the alternate buffer for the window we came from
if (curwin != old_curwin if (curwin != old_curwin
@ -7332,8 +7331,7 @@ static void ex_tabs(exarg_T *eap)
if (buf_spname(wp->w_buffer) != NULL) { if (buf_spname(wp->w_buffer) != NULL) {
STRLCPY(IObuff, buf_spname(wp->w_buffer), IOSIZE); STRLCPY(IObuff, buf_spname(wp->w_buffer), IOSIZE);
} else { } else {
home_replace(wp->w_buffer, wp->w_buffer->b_fname, home_replace(wp->w_buffer, wp->w_buffer->b_fname, IObuff, IOSIZE, true);
IObuff, IOSIZE, TRUE);
} }
msg_outtrans(IObuff); msg_outtrans(IObuff);
ui_flush(); // output one line at a time ui_flush(); // output one line at a time
@ -8689,7 +8687,7 @@ void exec_normal(bool was_typed)
static void ex_checkpath(exarg_T *eap) static void ex_checkpath(exarg_T *eap)
{ {
find_pattern_in_path(NULL, 0, 0, FALSE, FALSE, CHECK_PATH, 1L, find_pattern_in_path(NULL, 0, 0, false, false, CHECK_PATH, 1L,
eap->forceit ? ACTION_SHOW_ALL : ACTION_SHOW, eap->forceit ? ACTION_SHOW_ALL : ACTION_SHOW,
(linenr_T)1, (linenr_T)MAXLNUM); (linenr_T)1, (linenr_T)MAXLNUM);
} }
@ -8706,7 +8704,7 @@ static void ex_psearch(exarg_T *eap)
static void ex_findpat(exarg_T *eap) static void ex_findpat(exarg_T *eap)
{ {
int whole = TRUE; bool whole = true;
long n; long n;
char_u *p; char_u *p;
int action; int action;
@ -8951,7 +8949,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
buf_T *buf; buf_T *buf;
int valid = VALID_HEAD | VALID_PATH; // Assume valid result. int valid = VALID_HEAD | VALID_PATH; // Assume valid result.
bool tilde_file = false; bool tilde_file = false;
int skip_mod = false; bool skip_mod = false;
char strbuf[30]; char strbuf[30];
*errormsg = NULL; *errormsg = NULL;
@ -9021,7 +9019,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
if (escaped != NULL) { if (escaped != NULL) {
*escaped = TRUE; *escaped = TRUE;
} }
skip_mod = TRUE; skip_mod = true;
break; break;
} }
s = src + 1; s = src + 1;

View File

@ -134,16 +134,16 @@ void filemess(buf_T *buf, char_u *name, char_u *s, int attr)
msg_scroll = FALSE; msg_scroll = FALSE;
} }
if (!msg_scroll) { // wait a bit when overwriting an error msg if (!msg_scroll) { // wait a bit when overwriting an error msg
check_for_delay(FALSE); check_for_delay(false);
} }
msg_start(); msg_start();
msg_scroll = msg_scroll_save; msg_scroll = msg_scroll_save;
msg_scrolled_ign = TRUE; msg_scrolled_ign = true;
// may truncate the message to avoid a hit-return prompt // may truncate the message to avoid a hit-return prompt
msg_outtrans_attr(msg_may_trunc(FALSE, IObuff), attr); msg_outtrans_attr(msg_may_trunc(FALSE, IObuff), attr);
msg_clr_eos(); msg_clr_eos();
ui_flush(); ui_flush();
msg_scrolled_ign = FALSE; msg_scrolled_ign = false;
} }
@ -197,12 +197,12 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
long size = 0; long size = 0;
uint8_t *p = NULL; uint8_t *p = NULL;
off_T filesize = 0; off_T filesize = 0;
int skip_read = false; bool skip_read = false;
context_sha256_T sha_ctx; context_sha256_T sha_ctx;
int read_undo_file = false; int read_undo_file = false;
int split = 0; // number of split lines int split = 0; // number of split lines
linenr_T linecnt; linenr_T linecnt;
int error = FALSE; // errors encountered bool error = false; // errors encountered
int ff_error = EOL_UNKNOWN; // file format with errors int ff_error = EOL_UNKNOWN; // file format with errors
long linerest = 0; // remaining chars in line long linerest = 0; // remaining chars in line
int perm = 0; int perm = 0;
@ -212,7 +212,6 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
int fileformat = 0; // end-of-line format int fileformat = 0; // end-of-line format
bool keep_fileformat = false; bool keep_fileformat = false;
FileInfo file_info; FileInfo file_info;
int file_readonly;
linenr_T skip_count = 0; linenr_T skip_count = 0;
linenr_T read_count = 0; linenr_T read_count = 0;
int msg_save = msg_scroll; int msg_save = msg_scroll;
@ -236,12 +235,11 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
long real_size = 0; long real_size = 0;
# ifdef HAVE_ICONV # ifdef HAVE_ICONV
iconv_t iconv_fd = (iconv_t)-1; // descriptor for iconv() or -1 iconv_t iconv_fd = (iconv_t)-1; // descriptor for iconv() or -1
int did_iconv = false; // TRUE when iconv() failed and trying bool did_iconv = false; // true when iconv() failed and trying
// 'charconvert' next // 'charconvert' next
# endif # endif
int converted = FALSE; // TRUE if conversion done bool converted = false; // true if conversion done
int notconverted = FALSE; /* TRUE if conversion wanted but it bool notconverted = false; // true if conversion wanted but it wasn't possible
wasn't possible */
char_u conv_rest[CONV_RESTLEN]; char_u conv_rest[CONV_RESTLEN];
int conv_restlen = 0; // nr of bytes in conv_rest[] int conv_restlen = 0; // nr of bytes in conv_rest[]
buf_T *old_curbuf; buf_T *old_curbuf;
@ -437,7 +435,7 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
} }
// Check readonly. // Check readonly.
file_readonly = false; bool file_readonly = false;
if (!read_buffer && !read_stdin) { if (!read_buffer && !read_stdin) {
if (!newfile || readonlymode || !(perm & 0222) if (!newfile || readonlymode || !(perm & 0222)
|| !os_file_is_writable((char *)fname)) { || !os_file_is_writable((char *)fname)) {
@ -785,9 +783,9 @@ retry:
advance_fenc = false; advance_fenc = false;
if (eap != NULL && eap->force_enc != 0) { if (eap != NULL && eap->force_enc != 0) {
/* Conversion given with "++cc=" wasn't possible, read // Conversion given with "++cc=" wasn't possible, read
* without conversion. */ // without conversion.
notconverted = TRUE; notconverted = true;
conv_error = 0; conv_error = 0;
if (fenc_alloced) { if (fenc_alloced) {
xfree(fenc); xfree(fenc);
@ -866,7 +864,7 @@ retry:
if (fd < 0) { if (fd < 0) {
// Re-opening the original file failed! // Re-opening the original file failed!
EMSG(_("E202: Conversion made file unreadable!")); EMSG(_("E202: Conversion made file unreadable!"));
error = TRUE; error = true;
goto failed; goto failed;
} }
goto retry; goto retry;
@ -940,7 +938,7 @@ retry:
} }
} }
if (new_buffer == NULL) { if (new_buffer == NULL) {
error = TRUE; error = true;
break; break;
} }
if (linerest) { // copy characters from the previous buffer if (linerest) { // copy characters from the previous buffer
@ -1048,7 +1046,7 @@ retry:
if (size <= 0) { if (size <= 0) {
if (size < 0) { // read error if (size < 0) { // read error
error = TRUE; error = true;
} else if (conv_restlen > 0) { } else if (conv_restlen > 0) {
/* /*
* Reached end-of-file but some trailing bytes could * Reached end-of-file but some trailing bytes could
@ -1104,7 +1102,7 @@ retry:
} }
} }
skip_read = FALSE; skip_read = false;
/* /*
* At start of file: Check for BOM. * At start of file: Check for BOM.
@ -1151,7 +1149,7 @@ retry:
fenc_alloced = false; fenc_alloced = false;
} }
// retry reading without getting new bytes or rewinding // retry reading without getting new bytes or rewinding
skip_read = TRUE; skip_read = true;
goto retry; goto retry;
} }
} }
@ -1579,7 +1577,7 @@ rewind_retry:
*ptr = NUL; // end of line *ptr = NUL; // end of line
len = (colnr_T)(ptr - line_start + 1); len = (colnr_T)(ptr - line_start + 1);
if (ml_append(lnum, line_start, len, newfile) == FAIL) { if (ml_append(lnum, line_start, len, newfile) == FAIL) {
error = TRUE; error = true;
break; break;
} }
if (read_undo_file) { if (read_undo_file) {
@ -1587,7 +1585,7 @@ rewind_retry:
} }
++lnum; ++lnum;
if (--read_count == 0) { if (--read_count == 0) {
error = TRUE; // break loop error = true; // break loop
line_start = ptr; // nothing left to write line_start = ptr; // nothing left to write
break; break;
} }
@ -1635,7 +1633,7 @@ rewind_retry:
} }
} }
if (ml_append(lnum, line_start, len, newfile) == FAIL) { if (ml_append(lnum, line_start, len, newfile) == FAIL) {
error = TRUE; error = true;
break; break;
} }
if (read_undo_file) { if (read_undo_file) {
@ -1643,7 +1641,7 @@ rewind_retry:
} }
++lnum; ++lnum;
if (--read_count == 0) { if (--read_count == 0) {
error = TRUE; // break loop error = true; // break loop
line_start = ptr; // nothing left to write line_start = ptr; // nothing left to write
break; break;
} }
@ -1661,7 +1659,7 @@ rewind_retry:
failed: failed:
// not an error, max. number of lines reached // not an error, max. number of lines reached
if (error && read_count == 0) { if (error && read_count == 0) {
error = FALSE; error = false;
} }
/* /*
@ -1683,7 +1681,7 @@ failed:
*ptr = NUL; *ptr = NUL;
len = (colnr_T)(ptr - line_start + 1); len = (colnr_T)(ptr - line_start + 1);
if (ml_append(lnum, line_start, len, newfile) == FAIL) { if (ml_append(lnum, line_start, len, newfile) == FAIL) {
error = TRUE; error = true;
} else { } else {
if (read_undo_file) { if (read_undo_file) {
sha256_update(&sha_ctx, line_start, len); sha256_update(&sha_ctx, line_start, len);
@ -1848,7 +1846,7 @@ failed:
XFREE_CLEAR(keep_msg); XFREE_CLEAR(keep_msg);
p = NULL; p = NULL;
msg_scrolled_ign = TRUE; msg_scrolled_ign = true;
if (!read_stdin && !read_buffer) { if (!read_stdin && !read_buffer) {
p = msg_trunc_attr(IObuff, FALSE, 0); p = msg_trunc_attr(IObuff, FALSE, 0);
@ -1863,7 +1861,7 @@ failed:
// - When the screen was scrolled but there is no wait-return prompt. // - When the screen was scrolled but there is no wait-return prompt.
set_keep_msg(p, 0); set_keep_msg(p, 0);
} }
msg_scrolled_ign = FALSE; msg_scrolled_ign = false;
} }
// with errors writing the file requires ":w!" // with errors writing the file requires ":w!"
@ -3758,9 +3756,9 @@ static int set_rw_fname(char_u *fname, char_u *sfname)
// It's like the unnamed buffer is deleted.... // It's like the unnamed buffer is deleted....
if (curbuf->b_p_bl) { if (curbuf->b_p_bl) {
apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFDELETE, NULL, NULL, false, curbuf);
} }
apply_autocmds(EVENT_BUFWIPEOUT, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFWIPEOUT, NULL, NULL, false, curbuf);
if (aborting()) { // autocmds may abort script processing if (aborting()) { // autocmds may abort script processing
return FAIL; return FAIL;
} }
@ -3775,9 +3773,9 @@ static int set_rw_fname(char_u *fname, char_u *sfname)
} }
// ....and a new named one is created // ....and a new named one is created
apply_autocmds(EVENT_BUFNEW, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFNEW, NULL, NULL, false, curbuf);
if (curbuf->b_p_bl) { if (curbuf->b_p_bl) {
apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFADD, NULL, NULL, false, curbuf);
} }
if (aborting()) { // autocmds may abort script processing if (aborting()) { // autocmds may abort script processing
return FAIL; return FAIL;

View File

@ -459,7 +459,7 @@ int main(int argc, char **argv)
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
} }
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFENTER, NULL, NULL, false, curbuf);
TIME_MSG("BufEnter autocommands"); TIME_MSG("BufEnter autocommands");
setpcmark(); setpcmark();

View File

@ -3341,11 +3341,11 @@ static int do_swapexists(buf_T *buf, char_u *fname)
set_vim_var_string(VV_SWAPNAME, (char *) fname, -1); set_vim_var_string(VV_SWAPNAME, (char *) fname, -1);
set_vim_var_string(VV_SWAPCHOICE, NULL, -1); set_vim_var_string(VV_SWAPCHOICE, NULL, -1);
/* Trigger SwapExists autocommands with <afile> set to the file being // Trigger SwapExists autocommands with <afile> set to the file being
* edited. Disallow changing directory here. */ // edited. Disallow changing directory here.
++allbuf_lock; allbuf_lock++;
apply_autocmds(EVENT_SWAPEXISTS, buf->b_fname, NULL, FALSE, NULL); apply_autocmds(EVENT_SWAPEXISTS, buf->b_fname, NULL, false, NULL);
--allbuf_lock; allbuf_lock--;
set_vim_var_string(VV_SWAPNAME, NULL, -1); set_vim_var_string(VV_SWAPNAME, NULL, -1);

View File

@ -4532,7 +4532,7 @@ static int fmt_check_par(linenr_T lnum, int *leader_len, char_u **leader_flags,
ptr = ml_get(lnum); ptr = ml_get(lnum);
if (do_comments) { if (do_comments) {
*leader_len = get_leader_len(ptr, leader_flags, FALSE, TRUE); *leader_len = get_leader_len(ptr, leader_flags, false, true);
} else { } else {
*leader_len = 0; *leader_len = 0;
} }

View File

@ -5549,8 +5549,7 @@ void ex_vimgrep(exarg_T *eap)
// need to be done (again). But not the window-local // need to be done (again). But not the window-local
// options! // options!
aucmd_prepbuf(&aco, buf); aucmd_prepbuf(&aco, buf);
apply_autocmds(EVENT_FILETYPE, buf->b_p_ft, apply_autocmds(EVENT_FILETYPE, buf->b_p_ft, buf->b_fname, true, buf);
buf->b_fname, TRUE, buf);
do_modelines(OPT_NOWIN); do_modelines(OPT_NOWIN);
aucmd_restbuf(&aco); aucmd_restbuf(&aco);
} }
@ -5568,9 +5567,9 @@ void ex_vimgrep(exarg_T *eap)
qf_update_buffer(qi, NULL); qf_update_buffer(qi, NULL);
if (au_name != NULL) if (au_name != NULL) {
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, curbuf->b_fname, true, curbuf);
curbuf->b_fname, TRUE, curbuf); }
// The QuickFixCmdPost autocmd may free the quickfix list. Check the list // The QuickFixCmdPost autocmd may free the quickfix list. Check the list
// is still valid. // is still valid.

View File

@ -504,7 +504,7 @@ int update_screen(int type)
} }
if (clear_cmdline) { // going to clear cmdline (done below) if (clear_cmdline) { // going to clear cmdline (done below)
check_for_delay(FALSE); check_for_delay(false);
} }
/* Force redraw when width of 'number' or 'relativenumber' column /* Force redraw when width of 'number' or 'relativenumber' column
@ -2037,14 +2037,13 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
int tocol = MAXCOL; // end of inverting int tocol = MAXCOL; // end of inverting
int fromcol_prev = -2; // start of inverting after cursor int fromcol_prev = -2; // start of inverting after cursor
bool noinvcur = false; // don't invert the cursor bool noinvcur = false; // don't invert the cursor
int lnum_in_visual_area = false; bool lnum_in_visual_area = false;
pos_T pos; pos_T pos;
long v; long v;
int char_attr = 0; // attributes for next character int char_attr = 0; // attributes for next character
int attr_pri = FALSE; // char_attr has priority bool attr_pri = false; // char_attr has priority
int area_highlighting = FALSE; /* Visual or incsearch highlighting bool area_highlighting = false; // Visual or incsearch highlighting in this line
in this line */
int attr = 0; // attributes for area highlighting int attr = 0; // attributes for area highlighting
int area_attr = 0; // attributes desired by highlighting int area_attr = 0; // attributes desired by highlighting
int search_attr = 0; // attributes desired by 'hlsearch' int search_attr = 0; // attributes desired by 'hlsearch'
@ -2363,7 +2362,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
diff_hlf = HLF_ADD; // added line diff_hlf = HLF_ADD; // added line
} }
filler_lines = 0; filler_lines = 0;
area_highlighting = TRUE; area_highlighting = true;
} }
if (lnum == wp->w_topline) { if (lnum == wp->w_topline) {
filler_lines = wp->w_topfill; filler_lines = wp->w_topfill;
@ -2559,7 +2558,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
pos = wp->w_cursor; pos = wp->w_cursor;
wp->w_cursor.lnum = lnum; wp->w_cursor.lnum = lnum;
wp->w_cursor.col = linecol; wp->w_cursor.col = linecol;
len = spell_move_to(wp, FORWARD, TRUE, TRUE, &spell_hlf); len = spell_move_to(wp, FORWARD, true, true, &spell_hlf);
// spell_move_to() may call ml_get() and make "line" invalid // spell_move_to() may call ml_get() and make "line" invalid
line = ml_get_buf(wp->w_buffer, lnum, false); line = ml_get_buf(wp->w_buffer, lnum, false);
@ -6302,11 +6301,9 @@ void grid_fill(ScreenGrid *grid, int start_row, int end_row, int start_col, int
} }
} }
/* /// Check if there should be a delay. Used before clearing or redrawing the
* Check if there should be a delay. Used before clearing or redrawing the /// screen or the command line.
* screen or the command line. void check_for_delay(bool check_msg_scroll)
*/
void check_for_delay(int check_msg_scroll)
{ {
if ((emsg_on_display || (check_msg_scroll && msg_scroll)) if ((emsg_on_display || (check_msg_scroll && msg_scroll))
&& !did_wait_return && !did_wait_return
@ -6490,9 +6487,9 @@ retry:
* in case applying autocommands always changes Rows or Columns. * in case applying autocommands always changes Rows or Columns.
*/ */
if (starting == 0 && ++retry_count <= 3) { if (starting == 0 && ++retry_count <= 3) {
apply_autocmds(EVENT_VIMRESIZED, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_VIMRESIZED, NULL, NULL, false, curbuf);
/* In rare cases, autocommands may have altered Rows or Columns, // In rare cases, autocommands may have altered Rows or Columns,
* jump back to check if we need to allocate the screen again. */ // jump back to check if we need to allocate the screen again.
goto retry; goto retry;
} }
@ -6877,7 +6874,7 @@ int showmode(void)
bool nwr_save = need_wait_return; bool nwr_save = need_wait_return;
// wait a bit before overwriting an important message // wait a bit before overwriting an important message
check_for_delay(FALSE); check_for_delay(false);
// if the cmdline is more than one line high, erase top lines // if the cmdline is more than one line high, erase top lines
need_clear = clear_cmdline; need_clear = clear_cmdline;

View File

@ -5743,9 +5743,8 @@ void ex_ownsyntax(exarg_T *eap)
old_value = vim_strsave(old_value); old_value = vim_strsave(old_value);
} }
/* Apply the "syntax" autocommand event, this finds and loads the syntax // Apply the "syntax" autocommand event, this finds and loads the syntax file.
* file. */ apply_autocmds(EVENT_SYNTAX, eap->arg, curbuf->b_fname, true, curbuf);
apply_autocmds(EVENT_SYNTAX, eap->arg, curbuf->b_fname, TRUE, curbuf);
// Move value of b:current_syntax to w:current_syntax. // Move value of b:current_syntax to w:current_syntax.
new_value = get_var_value("b:current_syntax"); new_value = get_var_value("b:current_syntax");
@ -6604,7 +6603,7 @@ int load_colors(char_u *name)
retval = source_runtime(buf, DIP_START + DIP_OPT); retval = source_runtime(buf, DIP_START + DIP_OPT);
} }
xfree(buf); xfree(buf);
apply_autocmds(EVENT_COLORSCHEME, name, curbuf->b_fname, FALSE, curbuf); apply_autocmds(EVENT_COLORSCHEME, name, curbuf->b_fname, false, curbuf);
recursive = false; recursive = false;

View File

@ -755,7 +755,7 @@ void win_config_float(win_T *wp, FloatConfig fconfig)
api_clear_error(&dummy); api_clear_error(&dummy);
if (wp->w_float_config.bufpos.lnum >= 0) { if (wp->w_float_config.bufpos.lnum >= 0) {
pos_T pos = { wp->w_float_config.bufpos.lnum + 1, pos_T pos = { wp->w_float_config.bufpos.lnum + 1,
wp->w_float_config.bufpos.col, 0 }; wp->w_float_config.bufpos.col, 0 };
int trow, tcol, tcolc, tcole; int trow, tcol, tcolc, tcole;
textpos2screenpos(wp, &pos, &trow, &tcol, &tcolc, &tcole, true); textpos2screenpos(wp, &pos, &trow, &tcol, &tcolc, &tcole, true);
row += trow - 1; row += trow - 1;
@ -2459,7 +2459,7 @@ int win_close(win_T *win, bool free_buf)
if (wp->w_buffer != curbuf) { if (wp->w_buffer != curbuf) {
other_buffer = true; other_buffer = true;
win->w_closing = true; win->w_closing = true;
apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, false, curbuf);
if (!win_valid(win)) { if (!win_valid(win)) {
return FAIL; return FAIL;
} }
@ -3959,16 +3959,16 @@ static int leave_tabpage(buf_T *new_curbuf, bool trigger_leave_autocmds)
reset_VIsual_and_resel(); // stop Visual mode reset_VIsual_and_resel(); // stop Visual mode
if (trigger_leave_autocmds) { if (trigger_leave_autocmds) {
if (new_curbuf != curbuf) { if (new_curbuf != curbuf) {
apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, false, curbuf);
if (curtab != tp) { if (curtab != tp) {
return FAIL; return FAIL;
} }
} }
apply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_WINLEAVE, NULL, NULL, false, curbuf);
if (curtab != tp) { if (curtab != tp) {
return FAIL; return FAIL;
} }
apply_autocmds(EVENT_TABLEAVE, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_TABLEAVE, NULL, NULL, false, curbuf);
if (curtab != tp) { if (curtab != tp) {
return FAIL; return FAIL;
} }
@ -4044,9 +4044,9 @@ static void enter_tabpage(tabpage_T *tp, buf_T *old_curbuf, bool trigger_enter_a
/* Apply autocommands after updating the display, when 'rows' and /* Apply autocommands after updating the display, when 'rows' and
* 'columns' have been set correctly. */ * 'columns' have been set correctly. */
if (trigger_enter_autocmds) { if (trigger_enter_autocmds) {
apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_TABENTER, NULL, NULL, false, curbuf);
if (old_curbuf != curbuf) { if (old_curbuf != curbuf) {
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFENTER, NULL, NULL, false, curbuf);
} }
} }
@ -4472,7 +4472,7 @@ void win_enter(win_T *wp, bool undo_sync)
static void win_enter_ext(win_T *wp, bool undo_sync, bool curwin_invalid, bool trigger_new_autocmds, static void win_enter_ext(win_T *wp, bool undo_sync, bool curwin_invalid, bool trigger_new_autocmds,
bool trigger_enter_autocmds, bool trigger_leave_autocmds) bool trigger_enter_autocmds, bool trigger_leave_autocmds)
{ {
int other_buffer = FALSE; bool other_buffer = false;
if (wp == curwin && !curwin_invalid) { // nothing to do if (wp == curwin && !curwin_invalid) { // nothing to do
return; return;
@ -4483,13 +4483,13 @@ static void win_enter_ext(win_T *wp, bool undo_sync, bool curwin_invalid, bool t
* Be careful: If autocommands delete the window, return now. * Be careful: If autocommands delete the window, return now.
*/ */
if (wp->w_buffer != curbuf) { if (wp->w_buffer != curbuf) {
apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, false, curbuf);
other_buffer = TRUE; other_buffer = true;
if (!win_valid(wp)) { if (!win_valid(wp)) {
return; return;
} }
} }
apply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_WINLEAVE, NULL, NULL, false, curbuf);
if (!win_valid(wp)) { if (!win_valid(wp)) {
return; return;
} }