refactor: replace TRUE/FALSE with true/false

This commit is contained in:
Dundar Göc 2021-07-26 22:17:23 +02:00
parent c642f3ac27
commit 94120d2fd5
18 changed files with 177 additions and 170 deletions

View File

@ -98,7 +98,7 @@ void changed(void)
if (curbuf->b_may_swap if (curbuf->b_may_swap
&& !bt_dontwrite(curbuf) && !bt_dontwrite(curbuf)
) { ) {
int save_need_wait_return = need_wait_return; bool save_need_wait_return = need_wait_return;
need_wait_return = false; need_wait_return = false;
ml_open_file(curbuf); ml_open_file(curbuf);

View File

@ -1902,7 +1902,7 @@ void ex_function(exarg_T *eap)
char_u *line_to_free = NULL; char_u *line_to_free = NULL;
int c; int c;
int saved_did_emsg; int saved_did_emsg;
int saved_wait_return = need_wait_return; bool saved_wait_return = need_wait_return;
char_u *name = NULL; char_u *name = NULL;
char_u *p; char_u *p;
char_u *arg; char_u *arg;

View File

@ -1635,14 +1635,14 @@ void print_line(linenr_T lnum, int use_number, int list)
msg_start(); msg_start();
silent_mode = FALSE; silent_mode = FALSE;
info_message = TRUE; /* use mch_msg(), not mch_errmsg() */ info_message = true; // use mch_msg(), not mch_errmsg()
print_line_no_prefix(lnum, use_number, list); print_line_no_prefix(lnum, use_number, list);
if (save_silent) { if (save_silent) {
msg_putchar('\n'); msg_putchar('\n');
ui_flush(); ui_flush();
silent_mode = save_silent; silent_mode = save_silent;
} }
info_message = FALSE; info_message = false;
} }
int rename_buffer(char_u *new_fname) int rename_buffer(char_u *new_fname)
@ -1892,7 +1892,7 @@ int do_write(exarg_T *eap)
if (eap->cmdidx == CMD_saveas) { if (eap->cmdidx == CMD_saveas) {
if (retval == OK) { if (retval == OK) {
curbuf->b_p_ro = FALSE; curbuf->b_p_ro = FALSE;
redraw_tabline = TRUE; redraw_tabline = true;
} }
} }
@ -2812,8 +2812,9 @@ int do_ecmd(
redraw_curbuf_later(NOT_VALID); // redraw this buffer later redraw_curbuf_later(NOT_VALID); // redraw this buffer later
} }
if (p_im) if (p_im) {
need_start_insertmode = TRUE; need_start_insertmode = true;
}
/* Change directories when the 'acd' option is set. */ /* Change directories when the 'acd' option is set. */
do_autochdir(); do_autochdir();
@ -2879,7 +2880,7 @@ void ex_append(exarg_T *eap)
for (;; ) { for (;; ) {
msg_scroll = TRUE; msg_scroll = TRUE;
need_wait_return = FALSE; need_wait_return = false;
if (curbuf->b_p_ai) { if (curbuf->b_p_ai) {
if (append_indent >= 0) { if (append_indent >= 0) {
indent = append_indent; indent = append_indent;
@ -2967,8 +2968,8 @@ void ex_append(exarg_T *eap)
check_cursor_lnum(); check_cursor_lnum();
beginline(BL_SOL | BL_FIX); beginline(BL_SOL | BL_FIX);
need_wait_return = FALSE; /* don't use wait_return() now */ need_wait_return = false; // don't use wait_return() now
ex_no_reprint = TRUE; ex_no_reprint = true;
} }
/* /*
@ -3820,8 +3821,9 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
redraw_later(curwin, SOME_VALID); redraw_later(curwin, SOME_VALID);
curwin->w_p_fen = save_p_fen; curwin->w_p_fen = save_p_fen;
if (msg_row == Rows - 1) if (msg_row == Rows - 1) {
msg_didout = FALSE; /* avoid a scroll-up */ msg_didout = false; // avoid a scroll-up
}
msg_starthere(); msg_starthere();
i = msg_scroll; i = msg_scroll;
msg_scroll = 0; /* truncate msg when msg_scroll = 0; /* truncate msg when
@ -3840,8 +3842,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
typed = plain_vgetc(); typed = plain_vgetc();
no_mapping--; no_mapping--;
/* clear the question */ // clear the question
msg_didout = FALSE; /* don't scroll up */ msg_didout = false; // don't scroll up
msg_col = 0; msg_col = 0;
gotocmdline(true); gotocmdline(true);
p_lz = save_p_lz; p_lz = save_p_lz;

View File

@ -135,7 +135,7 @@ void do_debug(char_u *cmd)
const bool save_cmd_silent = cmd_silent; const bool save_cmd_silent = cmd_silent;
int save_msg_silent = msg_silent; int save_msg_silent = msg_silent;
int save_emsg_silent = emsg_silent; int save_emsg_silent = emsg_silent;
int save_redir_off = redir_off; bool save_redir_off = redir_off;
tasave_T typeaheadbuf; tasave_T typeaheadbuf;
bool typeahead_saved = false; bool typeahead_saved = false;
int save_ignore_script = 0; int save_ignore_script = 0;

View File

@ -306,13 +306,13 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline,
void *cookie, /* argument for fgetline() */ void *cookie, /* argument for fgetline() */
int flags) int flags)
{ {
char_u *next_cmdline; /* next cmd to execute */ char_u *next_cmdline; // next cmd to execute
char_u *cmdline_copy = NULL; /* copy of cmd line */ char_u *cmdline_copy = NULL; // copy of cmd line
int used_getline = FALSE; /* used "fgetline" to obtain command */ bool used_getline = false; // used "fgetline" to obtain command
static int recursive = 0; /* recursive depth */ static int recursive = 0; // recursive depth
int msg_didout_before_start = 0; bool msg_didout_before_start = false;
int count = 0; /* line number count */ int count = 0; // line number count
int did_inc = FALSE; /* incremented RedrawingDisabled */ int did_inc = FALSE; // incremented RedrawingDisabled
int retval = OK; int retval = OK;
cstack_T cstack = { // conditional stack cstack_T cstack = { // conditional stack
.cs_idx = -1, .cs_idx = -1,
@ -532,7 +532,7 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline,
retval = FAIL; retval = FAIL;
break; break;
} }
used_getline = TRUE; used_getline = true;
/* /*
* Keep the first typed line. Clear it when more lines are typed. * Keep the first typed line. Clear it when more lines are typed.
@ -573,7 +573,7 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline,
*/ */
if (!(flags & DOCMD_NOWAIT) && !recursive) { if (!(flags & DOCMD_NOWAIT) && !recursive) {
msg_didout_before_start = msg_didout; msg_didout_before_start = msg_didout;
msg_didany = FALSE; /* no output yet */ msg_didany = false; // no output yet
msg_start(); msg_start();
msg_scroll = TRUE; /* put messages below each other */ msg_scroll = TRUE; /* put messages below each other */
++no_wait_return; /* don't wait for return until finished */ ++no_wait_return; /* don't wait for return until finished */
@ -753,7 +753,7 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline,
|| (flags & DOCMD_REPEAT))); || (flags & DOCMD_REPEAT)));
xfree(cmdline_copy); xfree(cmdline_copy);
did_emsg_syntax = FALSE; did_emsg_syntax = false;
GA_DEEP_CLEAR(&lines_ga, wcmd_T, FREE_WCMD); GA_DEEP_CLEAR(&lines_ga, wcmd_T, FREE_WCMD);
if (cstack.cs_idx >= 0) { if (cstack.cs_idx >= 0) {
@ -927,8 +927,8 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline,
if (retval == FAIL if (retval == FAIL
|| (did_endif && KeyTyped && !did_emsg) || (did_endif && KeyTyped && !did_emsg)
) { ) {
need_wait_return = FALSE; need_wait_return = false;
msg_didany = FALSE; /* don't wait when restarting edit */ msg_didany = false; // don't wait when restarting edit
} else if (need_wait_return) { } else if (need_wait_return) {
/* /*
* The msg_start() above clears msg_didout. The wait_return we do * The msg_start() above clears msg_didout. The wait_return we do
@ -6652,9 +6652,10 @@ void tabpage_close_other(tabpage_T *tp, int forceit)
break; break;
} }
redraw_tabline = TRUE; redraw_tabline = true;
if (h != tabline_height()) if (h != tabline_height()) {
shell_new_rows(); shell_new_rows();
}
} }
/* /*
@ -6798,7 +6799,7 @@ static void ex_print(exarg_T *eap)
beginline(BL_SOL | BL_FIX); beginline(BL_SOL | BL_FIX);
} }
ex_no_reprint = TRUE; ex_no_reprint = true;
} }
static void ex_goto(exarg_T *eap) static void ex_goto(exarg_T *eap)
@ -7314,7 +7315,7 @@ do_exedit(
RedrawingDisabled = 0; RedrawingDisabled = 0;
no_wait_return = 0; no_wait_return = 0;
need_wait_return = FALSE; need_wait_return = false;
msg_scroll = 0; msg_scroll = 0;
redraw_all_later(NOT_VALID); redraw_all_later(NOT_VALID);
@ -7410,7 +7411,7 @@ do_exedit(
&& !cmdmod.keepalt) && !cmdmod.keepalt)
old_curwin->w_alt_fnum = curbuf->b_fnum; old_curwin->w_alt_fnum = curbuf->b_fnum;
ex_no_reprint = TRUE; ex_no_reprint = true;
} }
/// ":gui" and ":gvim" when there is no GUI. /// ":gui" and ":gvim" when there is no GUI.
@ -7909,8 +7910,8 @@ void ex_may_print(exarg_T *eap)
{ {
if (eap->flags != 0) { if (eap->flags != 0) {
print_line(curwin->w_cursor.lnum, (eap->flags & EXFLAG_NR), print_line(curwin->w_cursor.lnum, (eap->flags & EXFLAG_NR),
(eap->flags & EXFLAG_LIST)); (eap->flags & EXFLAG_LIST));
ex_no_reprint = TRUE; ex_no_reprint = true;
} }
} }
@ -7965,9 +7966,9 @@ static void ex_at(exarg_T *eap)
== FAIL) { == FAIL) {
beep_flush(); beep_flush();
} else { } else {
int save_efr = exec_from_reg; bool save_efr = exec_from_reg;
exec_from_reg = TRUE; exec_from_reg = true;
/* /*
* Execute from the typeahead buffer. * Execute from the typeahead buffer.
@ -8131,7 +8132,7 @@ static void ex_redir(exarg_T *eap)
if (redir_fd != NULL if (redir_fd != NULL
|| redir_reg || redir_vname || redir_reg || redir_vname
) )
redir_off = FALSE; redir_off = false;
} }
/// ":redraw": force redraw /// ":redraw": force redraw
@ -8158,12 +8159,12 @@ static void ex_redraw(exarg_T *eap)
RedrawingDisabled = r; RedrawingDisabled = r;
p_lz = p; p_lz = p;
/* Reset msg_didout, so that a message that's there is overwritten. */ // Reset msg_didout, so that a message that's there is overwritten.
msg_didout = FALSE; msg_didout = false;
msg_col = 0; msg_col = 0;
/* No need to wait after an intentional redraw. */ // No need to wait after an intentional redraw.
need_wait_return = FALSE; need_wait_return = false;
ui_flush(); ui_flush();
} }
@ -8346,7 +8347,9 @@ void restore_current_state(save_state_T *sst)
finish_op = sst->save_finish_op; finish_op = sst->save_finish_op;
opcount = sst->save_opcount; opcount = sst->save_opcount;
reg_executing = sst->save_reg_executing; reg_executing = sst->save_reg_executing;
msg_didout |= sst->save_msg_didout; // don't reset msg_didout now
// don't reset msg_didout now
msg_didout |= sst->save_msg_didout;
// Restore the state (needed when called from a function executed for // Restore the state (needed when called from a function executed for
// 'indentexpr'). Update the mouse and cursor, they may have changed. // 'indentexpr'). Update the mouse and cursor, they may have changed.

View File

@ -21,7 +21,7 @@
typedef struct { typedef struct {
int save_msg_scroll; int save_msg_scroll;
int save_restart_edit; int save_restart_edit;
int save_msg_didout; bool save_msg_didout;
int save_State; int save_State;
int save_insertmode; int save_insertmode;
bool save_finish_op; bool save_finish_op;

View File

@ -3455,7 +3455,7 @@ void redrawcmdline(void)
{ {
if (cmd_silent) if (cmd_silent)
return; return;
need_wait_return = FALSE; need_wait_return = false;
compute_cmdrow(); compute_cmdrow();
redrawcmd(); redrawcmd();
cursorcmd(); cursorcmd();
@ -4225,13 +4225,13 @@ static int showmatches(expand_T *xp, int wildmenu)
} }
if (!wildmenu) { if (!wildmenu) {
msg_didany = FALSE; /* lines_left will be set */ msg_didany = false; // lines_left will be set
msg_start(); /* prepare for paging */ msg_start(); // prepare for paging
msg_putchar('\n'); msg_putchar('\n');
ui_flush(); ui_flush();
cmdline_row = msg_row; cmdline_row = msg_row;
msg_didany = FALSE; /* lines_left will be set again */ msg_didany = false; // lines_left will be set again
msg_start(); /* prepare for paging */ msg_start(); // prepare for paging
} }
if (got_int) { if (got_int) {

View File

@ -290,7 +290,7 @@ readfile(
/* After reading a file the cursor line changes but we don't want to /* After reading a file the cursor line changes but we don't want to
* display the line. */ * display the line. */
ex_no_reprint = TRUE; ex_no_reprint = true;
// don't display the file info for another buffer now // don't display the file info for another buffer now
need_fileinfo = false; need_fileinfo = false;
@ -2237,7 +2237,7 @@ buf_write(
/* After writing a file changedtick changes but we don't want to display /* After writing a file changedtick changes but we don't want to display
* the line. */ * the line. */
ex_no_reprint = TRUE; ex_no_reprint = true;
/* /*
* If there is no file name yet, use the one for the written file. * If there is no file name yet, use the one for the written file.
@ -4241,7 +4241,7 @@ void shorten_fnames(int force)
mf_fullname(buf->b_ml.ml_mfp); mf_fullname(buf->b_ml.ml_mfp);
} }
status_redraw_all(); status_redraw_all();
redraw_tabline = TRUE; redraw_tabline = true;
} }
/// Get new filename ended by given extension. /// Get new filename ended by given extension.

View File

@ -138,14 +138,14 @@ EXTERN int mod_mask INIT(= 0x0); // current key modifiers
// update_screen(). // update_screen().
EXTERN int cmdline_row; EXTERN int cmdline_row;
EXTERN int redraw_cmdline INIT(= false); // cmdline must be redrawn EXTERN bool redraw_cmdline INIT(= false); // cmdline must be redrawn
EXTERN int clear_cmdline INIT(= false); // cmdline must be cleared EXTERN bool clear_cmdline INIT(= false); // cmdline must be cleared
EXTERN int mode_displayed INIT(= false); // mode is being displayed EXTERN bool mode_displayed INIT(= false); // mode is being displayed
EXTERN int cmdline_star INIT(= false); // cmdline is encrypted EXTERN int cmdline_star INIT(= false); // cmdline is encrypted
EXTERN bool redrawing_cmdline INIT(= false); // cmdline is being redrawn EXTERN bool redrawing_cmdline INIT(= false); // cmdline is being redrawn
EXTERN bool cmdline_was_last_drawn INIT(= false); // cmdline was last drawn EXTERN bool cmdline_was_last_drawn INIT(= false); // cmdline was last drawn
EXTERN int exec_from_reg INIT(= false); // executing register EXTERN bool exec_from_reg INIT(= false); // executing register
// When '$' is included in 'cpoptions' option set: // When '$' is included in 'cpoptions' option set:
// When a change command is given that deletes only part of a line, a dollar // When a change command is given that deletes only part of a line, a dollar
@ -204,12 +204,12 @@ EXTERN int keep_msg_attr INIT(= 0); // highlight attr for keep_msg
EXTERN bool keep_msg_more INIT(= false); // keep_msg was set by msgmore() EXTERN bool keep_msg_more INIT(= false); // keep_msg was set by msgmore()
EXTERN bool need_fileinfo INIT(= false); // do fileinfo() after redraw EXTERN bool need_fileinfo INIT(= false); // do fileinfo() after redraw
EXTERN int msg_scroll INIT(= false); // msg_start() will scroll EXTERN int msg_scroll INIT(= false); // msg_start() will scroll
EXTERN int msg_didout INIT(= false); // msg_outstr() was used in line EXTERN bool msg_didout INIT(= false); // msg_outstr() was used in line
EXTERN int msg_didany INIT(= false); // msg_outstr() was used at all EXTERN bool msg_didany INIT(= false); // msg_outstr() was used at all
EXTERN int msg_nowait INIT(= false); // don't wait for this msg EXTERN bool msg_nowait INIT(= false); // don't wait for this msg
EXTERN int emsg_off INIT(= 0); // don't display errors for now, EXTERN int emsg_off INIT(= 0); // don't display errors for now,
// unless 'debug' is set. // unless 'debug' is set.
EXTERN int info_message INIT(= false); // printing informative message EXTERN bool info_message INIT(= false); // printing informative message
EXTERN bool msg_hist_off INIT(= false); // don't add messages to history EXTERN bool msg_hist_off INIT(= false); // don't add messages to history
EXTERN bool need_clr_eos INIT(= false); // need to clear text before EXTERN bool need_clr_eos INIT(= false); // need to clear text before
// displaying a message. // displaying a message.
@ -225,18 +225,18 @@ EXTERN dict_T globvardict; // Dictionary with g: variables
EXTERN int did_emsg; // set by emsg() when the message EXTERN int did_emsg; // set by emsg() when the message
// is displayed or thrown // is displayed or thrown
EXTERN bool called_vim_beep; // set if vim_beep() is called EXTERN bool called_vim_beep; // set if vim_beep() is called
EXTERN int did_emsg_syntax; // did_emsg set because of a EXTERN bool did_emsg_syntax; // did_emsg set because of a
// syntax error // syntax error
EXTERN int called_emsg; // always set by emsg() EXTERN int called_emsg; // always set by emsg()
EXTERN int ex_exitval INIT(= 0); // exit value for ex mode EXTERN int ex_exitval INIT(= 0); // exit value for ex mode
EXTERN bool emsg_on_display INIT(= false); // there is an error message EXTERN bool emsg_on_display INIT(= false); // there is an error message
EXTERN int rc_did_emsg INIT(= false); // vim_regcomp() called emsg() EXTERN bool rc_did_emsg INIT(= false); // vim_regcomp() called emsg()
EXTERN int no_wait_return INIT(= 0); // don't wait for return for now EXTERN int no_wait_return INIT(= 0); // don't wait for return for now
EXTERN int need_wait_return INIT(= 0); // need to wait for return later EXTERN bool need_wait_return INIT(= false); // need to wait for return later
EXTERN bool did_wait_return INIT(= false); // wait_return() was used and EXTERN bool did_wait_return INIT(= false); // wait_return() was used and
// nothing written since then // nothing written since then
EXTERN bool need_maketitle INIT(= true); // call maketitle() soon EXTERN bool need_maketitle INIT(= true); // call maketitle() soon
EXTERN int quit_more INIT(= false); // 'q' hit at "--more--" msg EXTERN int quit_more INIT(= false); // 'q' hit at "--more--" msg
EXTERN int vgetc_busy INIT(= 0); // when inside vgetc() then > 0 EXTERN int vgetc_busy INIT(= 0); // when inside vgetc() then > 0
@ -449,7 +449,7 @@ EXTERN frame_T *topframe; // top of the window frame tree
EXTERN tabpage_T *first_tabpage; EXTERN tabpage_T *first_tabpage;
EXTERN tabpage_T *lastused_tabpage; EXTERN tabpage_T *lastused_tabpage;
EXTERN tabpage_T *curtab; EXTERN tabpage_T *curtab;
EXTERN int redraw_tabline INIT(= false); // need to redraw tabline EXTERN bool redraw_tabline INIT(= false); // need to redraw tabline
// Iterates over all tabs in the tab list // Iterates over all tabs in the tab list
# define FOR_ALL_TABS(tp) for (tabpage_T *tp = first_tabpage; tp != NULL; tp = tp->tp_next) # define FOR_ALL_TABS(tp) for (tabpage_T *tp = first_tabpage; tp != NULL; tp = tp->tp_next)
@ -621,7 +621,7 @@ EXTERN int motion_force INIT(=0); // motion force for pending operator
// Ex Mode (Q) state // Ex Mode (Q) state
EXTERN bool exmode_active INIT(= false); // true if Ex mode is active EXTERN bool exmode_active INIT(= false); // true if Ex mode is active
EXTERN int ex_no_reprint INIT(=false); // No need to print after z or p. EXTERN bool ex_no_reprint INIT(=false); // No need to print after z or p.
EXTERN int reg_recording INIT(= 0); // register for recording or zero EXTERN int reg_recording INIT(= 0); // register for recording or zero
EXTERN int reg_executing INIT(= 0); // register being executed or zero EXTERN int reg_executing INIT(= 0); // register being executed or zero
@ -699,14 +699,14 @@ EXTERN bool do_redraw INIT(= false); // extra redraw once
EXTERN bool must_redraw_pum INIT(= false); // redraw pum. NB: must_redraw EXTERN bool must_redraw_pum INIT(= false); // redraw pum. NB: must_redraw
// should also be set. // should also be set.
EXTERN int need_highlight_changed INIT(= true); EXTERN bool need_highlight_changed INIT(= true);
EXTERN FILE *scriptout INIT(= NULL); ///< Stream to write script to. EXTERN FILE *scriptout INIT(= NULL); ///< Stream to write script to.
// volatile because it is used in a signal handler. // volatile because it is used in a signal handler.
EXTERN volatile int got_int INIT(= false); // set to true when interrupt EXTERN volatile int got_int INIT(= false); // set to true when interrupt
// signal occurred // signal occurred
EXTERN int bangredo INIT(= false); // set to true with ! command EXTERN bool bangredo INIT(= false); // set to true with ! command
EXTERN int searchcmdlen; // length of previous search cmd EXTERN int searchcmdlen; // length of previous search cmd
EXTERN int reg_do_extmatch INIT(= 0); // Used when compiling regexp: EXTERN int reg_do_extmatch INIT(= 0); // Used when compiling regexp:
// REX_SET to allow \z\(...\), // REX_SET to allow \z\(...\),
@ -716,14 +716,14 @@ EXTERN reg_extmatch_T *re_extmatch_in INIT(= NULL);
// Set by vim_regexec() to store \z\(...\) matches // Set by vim_regexec() to store \z\(...\) matches
EXTERN reg_extmatch_T *re_extmatch_out INIT(= NULL); EXTERN reg_extmatch_T *re_extmatch_out INIT(= NULL);
EXTERN int did_outofmem_msg INIT(= false); EXTERN bool did_outofmem_msg INIT(= false);
// set after out of memory msg // set after out of memory msg
EXTERN int did_swapwrite_msg INIT(= false); EXTERN bool did_swapwrite_msg INIT(= false);
// set after swap write error msg // set after swap write error msg
EXTERN int global_busy INIT(= 0); // set when :global is executing EXTERN int global_busy INIT(= 0); // set when :global is executing
EXTERN int listcmd_busy INIT(= false); // set when :argdo, :windo or EXTERN bool listcmd_busy INIT(= false); // set when :argdo, :windo or
// :bufdo is executing // :bufdo is executing
EXTERN int need_start_insertmode INIT(= false); EXTERN bool need_start_insertmode INIT(= false);
// start insert mode soon // start insert mode soon
EXTERN char_u *last_cmdline INIT(= NULL); // last command line (for ":) EXTERN char_u *last_cmdline INIT(= NULL); // last command line (for ":)
EXTERN char_u *repeat_cmdline INIT(= NULL); // command line for "." EXTERN char_u *repeat_cmdline INIT(= NULL); // command line for "."
@ -738,9 +738,9 @@ EXTERN int postponed_split_flags INIT(= 0); // args for win_split()
EXTERN int postponed_split_tab INIT(= 0); // cmdmod.tab EXTERN int postponed_split_tab INIT(= 0); // cmdmod.tab
EXTERN int g_do_tagpreview INIT(= 0); // for tag preview commands: EXTERN int g_do_tagpreview INIT(= 0); // for tag preview commands:
// height of preview window // height of preview window
EXTERN int g_tag_at_cursor INIT(= false); // whether the tag command comes EXTERN bool g_tag_at_cursor INIT(= false); // whether the tag command comes
// from the command line (0) or was // from the command line (0) or was
// invoked as a normal command (1) // invoked as a normal command (1)
EXTERN int replace_offset INIT(= 0); // offset for replace_push() EXTERN int replace_offset INIT(= 0); // offset for replace_push()
@ -754,7 +754,7 @@ EXTERN int keep_help_flag INIT(= false); // doing :ta from help file
// everywhere. // everywhere.
EXTERN char_u *empty_option INIT(= (char_u *)""); EXTERN char_u *empty_option INIT(= (char_u *)"");
EXTERN int redir_off INIT(= false); // no redirection for a moment EXTERN bool redir_off INIT(= false); // no redirection for a moment
EXTERN FILE *redir_fd INIT(= NULL); // message redirection file EXTERN FILE *redir_fd INIT(= NULL); // message redirection file
EXTERN int redir_reg INIT(= 0); // message redirection register EXTERN int redir_reg INIT(= 0); // message redirection register
EXTERN int redir_vname INIT(= 0); // message redirection variable EXTERN int redir_vname INIT(= 0); // message redirection variable
@ -788,8 +788,8 @@ extern char_u *compiled_sys;
EXTERN char_u *globaldir INIT(= NULL); EXTERN char_u *globaldir INIT(= NULL);
// Whether 'keymodel' contains "stopsel" and "startsel". // Whether 'keymodel' contains "stopsel" and "startsel".
EXTERN int km_stopsel INIT(= false); EXTERN bool km_stopsel INIT(= false);
EXTERN int km_startsel INIT(= false); EXTERN bool km_startsel INIT(= false);
EXTERN int cedit_key INIT(= -1); ///< key value of 'cedit' option EXTERN int cedit_key INIT(= -1); ///< key value of 'cedit' option
EXTERN int cmdwin_type INIT(= 0); ///< type of cmdline window or 0 EXTERN int cmdwin_type INIT(= 0); ///< type of cmdline window or 0

View File

@ -1448,7 +1448,7 @@ static void read_stdin(void)
// When getting the ATTENTION prompt here, use a dialog. // When getting the ATTENTION prompt here, use a dialog.
swap_exists_action = SEA_DIALOG; swap_exists_action = SEA_DIALOG;
no_wait_return = true; no_wait_return = true;
int save_msg_didany = msg_didany; bool save_msg_didany = msg_didany;
set_buflisted(true); set_buflisted(true);
// Create memfile and read from stdin. // Create memfile and read from stdin.
(void)open_buffer(true, NULL, 0); (void)open_buffer(true, NULL, 0);
@ -2005,10 +2005,10 @@ static void mainerr(const char *errstr, const char *str)
/// Prints version information for "nvim -v" or "nvim --version". /// Prints version information for "nvim -v" or "nvim --version".
static void version(void) static void version(void)
{ {
info_message = TRUE; // use mch_msg(), not mch_errmsg() info_message = true; // use mch_msg(), not mch_errmsg()
list_version(); list_version();
msg_putchar('\n'); msg_putchar('\n');
msg_didout = FALSE; msg_didout = false;
} }
/// Prints help message for "nvim -h" or "nvim --help". /// Prints help message for "nvim -h" or "nvim --help".

View File

@ -346,10 +346,10 @@ pos_T *getmark_buf_fnum(buf_T *buf, int c, bool changefile, int *fnum)
} else if (c == '{' || c == '}') { // to previous/next paragraph } else if (c == '{' || c == '}') { // to previous/next paragraph
pos_T pos; pos_T pos;
oparg_T oa; oparg_T oa;
int slcb = listcmd_busy; bool slcb = listcmd_busy;
pos = curwin->w_cursor; pos = curwin->w_cursor;
listcmd_busy = TRUE; /* avoid that '' is changed */ listcmd_busy = true; // avoid that '' is changed
if (findpar(&oa.inclusive, if (findpar(&oa.inclusive,
c == '}' ? FORWARD : BACKWARD, 1L, NUL, FALSE)) { c == '}' ? FORWARD : BACKWARD, 1L, NUL, FALSE)) {
pos_copy = curwin->w_cursor; pos_copy = curwin->w_cursor;
@ -359,10 +359,10 @@ pos_T *getmark_buf_fnum(buf_T *buf, int c, bool changefile, int *fnum)
listcmd_busy = slcb; listcmd_busy = slcb;
} else if (c == '(' || c == ')') { /* to previous/next sentence */ } else if (c == '(' || c == ')') { /* to previous/next sentence */
pos_T pos; pos_T pos;
int slcb = listcmd_busy; bool slcb = listcmd_busy;
pos = curwin->w_cursor; pos = curwin->w_cursor;
listcmd_busy = TRUE; /* avoid that '' is changed */ listcmd_busy = true; // avoid that '' is changed
if (findsent(c == ')' ? FORWARD : BACKWARD, 1L)) { if (findsent(c == ')' ? FORWARD : BACKWARD, 1L)) {
pos_copy = curwin->w_cursor; pos_copy = curwin->w_cursor;
posp = &pos_copy; posp = &pos_copy;

View File

@ -3575,9 +3575,10 @@ static char *findswapname(buf_T *buf, char **dirp, char *old_fname,
} }
} else { } else {
MSG_PUTS("\n"); MSG_PUTS("\n");
if (msg_silent == 0) if (msg_silent == 0) {
/* call wait_return() later */ // call wait_return() later
need_wait_return = TRUE; need_wait_return = true;
}
} }
} }

View File

@ -79,12 +79,12 @@ static int verbose_did_open = FALSE;
/* /*
* When writing messages to the screen, there are many different situations. * When writing messages to the screen, there are many different situations.
* A number of variables is used to remember the current state: * A number of variables is used to remember the current state:
* msg_didany TRUE when messages were written since the last time the * msg_didany true when messages were written since the last time the
* user reacted to a prompt. * user reacted to a prompt.
* Reset: After hitting a key for the hit-return prompt, * Reset: After hitting a key for the hit-return prompt,
* hitting <CR> for the command line or input(). * hitting <CR> for the command line or input().
* Set: When any message is written to the screen. * Set: When any message is written to the screen.
* msg_didout TRUE when something was written to the current line. * msg_didout true when something was written to the current line.
* Reset: When advancing to the next line, when the current * Reset: When advancing to the next line, when the current
* text can be overwritten. * text can be overwritten.
* Set: When any message is written to the screen. * Set: When any message is written to the screen.
@ -102,7 +102,7 @@ static int verbose_did_open = FALSE;
* work without an extra prompt. * work without an extra prompt.
* lines_left Number of lines available for messages before the * lines_left Number of lines available for messages before the
* more-prompt is to be given. -1 when not set. * more-prompt is to be given. -1 when not set.
* need_wait_return TRUE when the hit-return prompt is needed. * need_wait_return true when the hit-return prompt is needed.
* Reset: After giving the hit-return prompt, when the user * Reset: After giving the hit-return prompt, when the user
* has answered some other prompt. * has answered some other prompt.
* Set: When the ruler or typeahead display is overwritten, * Set: When the ruler or typeahead display is overwritten,
@ -1097,14 +1097,14 @@ void wait_return(int redraw)
*/ */
if (vgetc_busy > 0) if (vgetc_busy > 0)
return; return;
need_wait_return = TRUE; need_wait_return = true;
if (no_wait_return) { if (no_wait_return) {
if (!exmode_active) if (!exmode_active)
cmdline_row = msg_row; cmdline_row = msg_row;
return; return;
} }
redir_off = TRUE; /* don't redirect this message */ redir_off = true; // don't redirect this message
oldState = State; oldState = State;
if (quit_more) { if (quit_more) {
c = CAR; /* just pretend CR was hit */ c = CAR; /* just pretend CR was hit */
@ -1165,11 +1165,11 @@ void wait_return(int redraw)
if (p_more) { if (p_more) {
if (c == 'b' || c == 'k' || c == 'u' || c == 'g' if (c == 'b' || c == 'k' || c == 'u' || c == 'g'
|| c == K_UP || c == K_PAGEUP) { || c == K_UP || c == K_PAGEUP) {
if (msg_scrolled > Rows) if (msg_scrolled > Rows) {
/* scroll back to show older messages */ // scroll back to show older messages
do_more_prompt(c); do_more_prompt(c);
else { } else {
msg_didout = FALSE; msg_didout = false;
c = K_IGNORE; c = K_IGNORE;
msg_col = msg_col =
cmdmsg_rl ? Columns - 1 : cmdmsg_rl ? Columns - 1 :
@ -1353,7 +1353,7 @@ void msg_start(void)
void msg_starthere(void) void msg_starthere(void)
{ {
lines_left = cmdline_row; lines_left = cmdline_row;
msg_didany = FALSE; msg_didany = false;
} }
void msg_putchar(int c) void msg_putchar(int c)
@ -2145,15 +2145,17 @@ static void msg_puts_display(const char_u *str, int maxlen, int attr,
store_sb_text((char_u **)&sb_str, (char_u *)s, attr, &sb_col, true); store_sb_text((char_u **)&sb_str, (char_u *)s, attr, &sb_col, true);
} }
if (*s == '\n') { /* go to next line */ if (*s == '\n') { // go to next line
msg_didout = FALSE; /* remember that line is empty */ msg_didout = false; // remember that line is empty
if (cmdmsg_rl) if (cmdmsg_rl) {
msg_col = Columns - 1; msg_col = Columns - 1;
else } else {
msg_col = 0; msg_col = 0;
if (++msg_row >= Rows) /* safety check */ }
if (++msg_row >= Rows) { // safety check
msg_row = Rows - 1; msg_row = Rows - 1;
} else if (*s == '\r') { /* go to column 0 */ }
} else if (*s == '\r') { // go to column 0
msg_col = 0; msg_col = 0;
} else if (*s == '\b') { /* go to previous char */ } else if (*s == '\b') { /* go to previous char */
if (msg_col) if (msg_col)
@ -2708,9 +2710,9 @@ static int do_more_prompt(int typed_char)
/* Since got_int is set all typeahead will be flushed, but we /* Since got_int is set all typeahead will be flushed, but we
* want to keep this ':', remember that in a special way. */ * want to keep this ':', remember that in a special way. */
typeahead_noflush(':'); typeahead_noflush(':');
cmdline_row = Rows - 1; /* put ':' on this line */ cmdline_row = Rows - 1; // put ':' on this line
skip_redraw = TRUE; /* skip redraw once */ skip_redraw = true; // skip redraw once
need_wait_return = FALSE; /* don't wait in main() */ need_wait_return = false; // don't wait in main()
} }
FALLTHROUGH; FALLTHROUGH;
case 'q': // quit case 'q': // quit
@ -2931,7 +2933,7 @@ void repeat_message(void)
/* Avoid drawing the "hit-enter" prompt below the previous one, /* Avoid drawing the "hit-enter" prompt below the previous one,
* overwrite it. Esp. useful when regaining focus and a * overwrite it. Esp. useful when regaining focus and a
* FocusGained autocmd exists but didn't draw anything. */ * FocusGained autocmd exists but didn't draw anything. */
msg_didout = FALSE; msg_didout = false;
msg_col = 0; msg_col = 0;
msg_clr_eos(); msg_clr_eos();
} }
@ -3095,8 +3097,8 @@ void msg_check(void)
return; return;
} }
if (msg_row == Rows - 1 && msg_col >= sc_col) { if (msg_row == Rows - 1 && msg_col >= sc_col) {
need_wait_return = TRUE; need_wait_return = true;
redraw_cmdline = TRUE; redraw_cmdline = true;
} }
} }

View File

@ -437,8 +437,8 @@ int update_screen(int type)
} }
} }
} }
redraw_cmdline = TRUE; redraw_cmdline = true;
redraw_tabline = TRUE; redraw_tabline = true;
} }
msg_scrolled = 0; msg_scrolled = 0;
msg_scrolled_at_flush = 0; msg_scrolled_at_flush = 0;
@ -6786,8 +6786,8 @@ void grid_del_lines(ScreenGrid *grid, int row, int line_count, int end, int col,
// Show the current mode and ruler. // Show the current mode and ruler.
// //
// If clear_cmdline is TRUE, clear the rest of the cmdline. // If clear_cmdline is true, clear the rest of the cmdline.
// If clear_cmdline is FALSE there may be a message there that needs to be // If clear_cmdline is false there may be a message there that needs to be
// cleared only if a mode is shown. // cleared only if a mode is shown.
// Return the length of the message (0 if no message). // Return the length of the message (0 if no message).
int showmode(void) int showmode(void)
@ -6796,7 +6796,6 @@ int showmode(void)
int length = 0; int length = 0;
int do_mode; int do_mode;
int attr; int attr;
int nwr_save;
int sub_attr; int sub_attr;
if (ui_has(kUIMessages) && clear_cmdline) { if (ui_has(kUIMessages) && clear_cmdline) {
@ -6818,11 +6817,11 @@ int showmode(void)
// Call char_avail() only when we are going to show something, because // Call char_avail() only when we are going to show something, because
// it takes a bit of time. // it takes a bit of time.
if (!redrawing() || (char_avail() && !KeyTyped) || msg_silent != 0) { if (!redrawing() || (char_avail() && !KeyTyped) || msg_silent != 0) {
redraw_cmdline = TRUE; /* show mode later */ redraw_cmdline = true; // show mode later
return 0; return 0;
} }
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);
@ -6939,10 +6938,11 @@ int showmode(void)
need_clear = true; need_clear = true;
} }
mode_displayed = TRUE; mode_displayed = true;
if (need_clear || clear_cmdline) if (need_clear || clear_cmdline) {
msg_clr_eos(); msg_clr_eos();
msg_didout = FALSE; /* overwrite this message */ }
msg_didout = false; // overwrite this message
length = msg_col; length = msg_col;
msg_col = 0; msg_col = 0;
msg_no_more = false; msg_no_more = false;
@ -7198,7 +7198,7 @@ void draw_tabline(void)
/* Reset the flag here again, in case evaluating 'tabline' causes it to be /* Reset the flag here again, in case evaluating 'tabline' causes it to be
* set. */ * set. */
redraw_tabline = FALSE; redraw_tabline = false;
} }
void ui_ext_tabline_update(void) void ui_ext_tabline_update(void)

View File

@ -137,7 +137,7 @@ search_regcomp(
int magic; int magic;
int i; int i;
rc_did_emsg = FALSE; rc_did_emsg = false;
magic = p_magic; magic = p_magic;
/* /*
@ -153,7 +153,7 @@ search_regcomp(
EMSG(_(e_nopresub)); EMSG(_(e_nopresub));
else else
EMSG(_(e_noprevre)); EMSG(_(e_noprevre));
rc_did_emsg = TRUE; rc_did_emsg = true;
return FAIL; return FAIL;
} }
pat = spats[i].pat; pat = spats[i].pat;
@ -3110,7 +3110,7 @@ current_word(
inc_cursor(); inc_cursor();
if (VIsual_mode == 'V') { if (VIsual_mode == 'V') {
VIsual_mode = 'v'; VIsual_mode = 'v';
redraw_cmdline = TRUE; /* show mode later */ redraw_cmdline = true; // show mode later
} }
} else } else
oap->inclusive = inclusive; oap->inclusive = inclusive;
@ -4105,7 +4105,7 @@ bool current_quote(
} }
if (VIsual_mode == 'V') { if (VIsual_mode == 'V') {
VIsual_mode = 'v'; VIsual_mode = 'v';
redraw_cmdline = TRUE; /* show mode later */ redraw_cmdline = true; // show mode later
} }
} else { } else {
/* Set inclusive and other oap's flags. */ /* Set inclusive and other oap's flags. */

View File

@ -3945,7 +3945,7 @@ static int tree_add_word(spellinfo_T *spin, char_u *word, wordnode_T *root, int
msg_start(); msg_start();
msg_puts(_(msg_compressing)); msg_puts(_(msg_compressing));
msg_clr_eos(); msg_clr_eos();
msg_didout = FALSE; msg_didout = false;
msg_col = 0; msg_col = 0;
ui_flush(); ui_flush();
} }

View File

@ -7703,7 +7703,7 @@ void highlight_changed(void)
int id_SNC = 0; int id_SNC = 0;
int hlcnt; int hlcnt;
need_highlight_changed = FALSE; need_highlight_changed = false;
/// Translate builtin highlight groups into attributes for quick lookup. /// Translate builtin highlight groups into attributes for quick lookup.
for (int hlf = 0; hlf < (int)HLF_COUNT; hlf++) { for (int hlf = 0; hlf < (int)HLF_COUNT; hlf++) {

View File

@ -2275,8 +2275,8 @@ static bool close_last_window_tabpage(win_T *win, bool free_buf,
* Don't trigger autocommands yet, they may use wrong values, so do * Don't trigger autocommands yet, they may use wrong values, so do
* that below. * that below.
*/ */
goto_tabpage_tp(alt_tabpage(), FALSE, TRUE); goto_tabpage_tp(alt_tabpage(), false, true);
redraw_tabline = TRUE; redraw_tabline = true;
// save index for tabclosed event // save index for tabclosed event
char_u prev_idx[NUMBUFLEN]; char_u prev_idx[NUMBUFLEN];
@ -3834,18 +3834,15 @@ int tabpage_index(tabpage_T *ftp)
return i; return i;
} }
/* /// Prepare for leaving the current tab page.
* Prepare for leaving the current tab page. /// When autocommands change "curtab" we don't leave the tab page and return
* When autocommands change "curtab" we don't leave the tab page and return /// FAIL.
* FAIL. /// Careful: When OK is returned need to get a new tab page very very soon!
* Careful: When OK is returned need to get a new tab page very very soon! ///
*/ /// @param new_curbuf what is going to be the new curbuf,
static int /// NULL if unknown.
leave_tabpage ( /// @param trigger_leave_autocmds when true trigger *Leave autocommands.
buf_T *new_curbuf, /* what is going to be the new curbuf, static int leave_tabpage(buf_T *new_curbuf, bool trigger_leave_autocmds)
NULL if unknown */
int trigger_leave_autocmds
)
{ {
tabpage_T *tp = curtab; tabpage_T *tp = curtab;
@ -3874,13 +3871,14 @@ leave_tabpage (
return OK; return OK;
} }
/* /// Start using tab page "tp".
* Start using tab page "tp". /// Only to be used after leave_tabpage() or freeing the current tab page.
* Only to be used after leave_tabpage() or freeing the current tab page. ///
* Only trigger *Enter autocommands when trigger_enter_autocmds is TRUE. /// @param trigger_enter_autocmds when true trigger *Enter autocommands.
* Only trigger *Leave autocommands when trigger_leave_autocmds is TRUE. /// @param trigger_leave_autocmds when true trigger *Leave autocommands.
*/ static void enter_tabpage(tabpage_T *tp, buf_T *old_curbuf,
static void enter_tabpage(tabpage_T *tp, buf_T *old_curbuf, int trigger_enter_autocmds, int trigger_leave_autocmds) bool trigger_enter_autocmds,
bool trigger_leave_autocmds)
{ {
int old_off = tp->tp_firstwin->w_winrow; int old_off = tp->tp_firstwin->w_winrow;
win_T *next_prevwin = tp->tp_prevwin; win_T *next_prevwin = tp->tp_prevwin;
@ -4023,17 +4021,16 @@ void goto_tabpage(int n)
} }
} }
goto_tabpage_tp(tp, TRUE, TRUE); goto_tabpage_tp(tp, true, true);
} }
/* /// Go to tabpage "tp".
* Go to tabpage "tp". /// Note: doesn't update the GUI tab.
* Only trigger *Enter autocommands when trigger_enter_autocmds is TRUE. ///
* Only trigger *Leave autocommands when trigger_leave_autocmds is TRUE. /// @param trigger_enter_autocmds when true trigger *Enter autocommands.
* Note: doesn't update the GUI tab. /// @param trigger_leave_autocmds when true trigger *Leave autocommands.
*/ void goto_tabpage_tp(tabpage_T *tp, bool trigger_enter_autocmds,
void goto_tabpage_tp(tabpage_T *tp, int trigger_enter_autocmds, int trigger_leave_autocmds) bool trigger_leave_autocmds)
{ {
/* Don't repeat a message in another tab page. */ /* Don't repeat a message in another tab page. */
set_keep_msg(NULL, 0); set_keep_msg(NULL, 0);
@ -4064,7 +4061,7 @@ void goto_tabpage_lastused(void)
*/ */
void goto_tabpage_win(tabpage_T *tp, win_T *wp) void goto_tabpage_win(tabpage_T *tp, win_T *wp)
{ {
goto_tabpage_tp(tp, TRUE, TRUE); goto_tabpage_tp(tp, true, true);
if (curtab == tp && win_valid(wp)) { if (curtab == tp && win_valid(wp)) {
win_enter(wp, true); win_enter(wp, true);
} }
@ -4120,8 +4117,8 @@ void tabpage_move(int nr)
tp_dst->tp_next = curtab; tp_dst->tp_next = curtab;
} }
/* Need to redraw the tabline. Tab page contents doesn't change. */ // Need to redraw the tabline. Tab page contents doesn't change.
redraw_tabline = TRUE; redraw_tabline = true;
} }
@ -4350,8 +4347,8 @@ void win_enter(win_T *wp, bool undo_sync)
* been closed and isn't valid. * been closed and isn't valid.
*/ */
static void win_enter_ext(win_T *wp, bool undo_sync, int curwin_invalid, static void win_enter_ext(win_T *wp, bool undo_sync, int curwin_invalid,
int trigger_new_autocmds, int trigger_enter_autocmds, int trigger_new_autocmds, bool trigger_enter_autocmds,
int trigger_leave_autocmds) bool trigger_leave_autocmds)
{ {
int other_buffer = FALSE; int other_buffer = FALSE;
@ -5907,13 +5904,13 @@ void command_height(void)
grid_fill(&default_grid, cmdline_row, Rows, 0, Columns, ' ', ' ', 0); grid_fill(&default_grid, cmdline_row, Rows, 0, Columns, ' ', ' ', 0);
} }
msg_row = cmdline_row; msg_row = cmdline_row;
redraw_cmdline = TRUE; redraw_cmdline = true;
return; return;
} }
if (msg_row < cmdline_row) if (msg_row < cmdline_row)
msg_row = cmdline_row; msg_row = cmdline_row;
redraw_cmdline = TRUE; redraw_cmdline = true;
} }
frame_add_height(frp, (int)(old_p_ch - p_ch)); frame_add_height(frp, (int)(old_p_ch - p_ch));
@ -6434,8 +6431,9 @@ int switch_win_noblock(win_T **save_curwin, tabpage_T **save_curtab,
curtab = tp; curtab = tp;
firstwin = curtab->tp_firstwin; firstwin = curtab->tp_firstwin;
lastwin = curtab->tp_lastwin; lastwin = curtab->tp_lastwin;
} else } else {
goto_tabpage_tp(tp, FALSE, FALSE); goto_tabpage_tp(tp, false, false);
}
} }
if (!win_valid(win)) { if (!win_valid(win)) {
return FAIL; return FAIL;
@ -6465,8 +6463,9 @@ void restore_win_noblock(win_T *save_curwin, tabpage_T *save_curtab,
curtab = save_curtab; curtab = save_curtab;
firstwin = curtab->tp_firstwin; firstwin = curtab->tp_firstwin;
lastwin = curtab->tp_lastwin; lastwin = curtab->tp_lastwin;
} else } else {
goto_tabpage_tp(save_curtab, FALSE, FALSE); goto_tabpage_tp(save_curtab, false, false);
}
} }
if (win_valid(save_curwin)) { if (win_valid(save_curwin)) {
curwin = save_curwin; curwin = save_curwin;