mirror of
https://github.com/neovim/neovim.git
synced 2025-09-16 08:18:17 +00:00
refactor: replace TRUE/FALSE macros with C99 true/false
This commit is contained in:
@@ -540,12 +540,10 @@ bool close_buffer(win_T *win, buf_T *buf, int action, bool abort_if_last)
|
|||||||
del_buf = true;
|
del_buf = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Free all things allocated for this buffer.
|
||||||
* Free all things allocated for this buffer.
|
// Also calls the "BufDelete" autocommands when del_buf is true.
|
||||||
* Also calls the "BufDelete" autocommands when del_buf is TRUE.
|
// Remember if we are closing the current buffer. Restore the number of
|
||||||
*/
|
// windows, so that autocommands in buf_freeall() don't get confused.
|
||||||
/* Remember if we are closing the current buffer. Restore the number of
|
|
||||||
* windows, so that autocommands in buf_freeall() don't get confused. */
|
|
||||||
bool is_curbuf = (buf == curbuf);
|
bool is_curbuf = (buf == curbuf);
|
||||||
|
|
||||||
// When closing the current buffer stop Visual mode before freeing
|
// When closing the current buffer stop Visual mode before freeing
|
||||||
@@ -5046,8 +5044,8 @@ do_arg_all(
|
|||||||
xfree(opened);
|
xfree(opened);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return TRUE if "buf" is a prompt buffer.
|
/// @return true if "buf" is a prompt buffer.
|
||||||
int bt_prompt(buf_T *buf)
|
bool bt_prompt(buf_T *buf)
|
||||||
{
|
{
|
||||||
return buf != NULL && buf->b_p_bt[0] == 'p';
|
return buf != NULL && buf->b_p_bt[0] == 'p';
|
||||||
}
|
}
|
||||||
|
@@ -779,7 +779,7 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
|
|||||||
int movelen = oldlen - col - count + 1; // includes trailing NUL
|
int movelen = oldlen - col - count + 1; // includes trailing NUL
|
||||||
if (movelen <= 1) {
|
if (movelen <= 1) {
|
||||||
// If we just took off the last character of a non-blank line, and
|
// If we just took off the last character of a non-blank line, and
|
||||||
// fixpos is TRUE, we don't want to end up positioned at the NUL,
|
// fixpos is true, we don't want to end up positioned at the NUL,
|
||||||
// unless "restart_edit" is set or 'virtualedit' contains "onemore".
|
// unless "restart_edit" is set or 'virtualedit' contains "onemore".
|
||||||
if (col > 0 && fixpos && restart_edit == 0
|
if (col > 0 && fixpos && restart_edit == 0
|
||||||
&& (ve_flags & VE_ONEMORE) == 0
|
&& (ve_flags & VE_ONEMORE) == 0
|
||||||
|
@@ -1502,10 +1502,10 @@ char_u *get_digraph_for_char(int val_arg)
|
|||||||
/// Get a digraph. Used after typing CTRL-K on the command line or in normal
|
/// Get a digraph. Used after typing CTRL-K on the command line or in normal
|
||||||
/// mode.
|
/// mode.
|
||||||
///
|
///
|
||||||
/// @param cmdline TRUE when called from the cmdline
|
/// @param cmdline true when called from the cmdline
|
||||||
///
|
///
|
||||||
/// @returns composed character, or NUL when ESC was used.
|
/// @returns composed character, or NUL when ESC was used.
|
||||||
int get_digraph(int cmdline)
|
int get_digraph(bool cmdline)
|
||||||
{
|
{
|
||||||
int cc;
|
int cc;
|
||||||
no_mapping++;
|
no_mapping++;
|
||||||
|
@@ -46,7 +46,7 @@ void highlight_init(void)
|
|||||||
.id1 = 0, .id2 = 0 }));
|
.id1 = 0, .id2 = 0 }));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @return TRUE if hl table was reset
|
/// @return true if hl table was reset
|
||||||
bool highlight_use_hlstate(void)
|
bool highlight_use_hlstate(void)
|
||||||
{
|
{
|
||||||
if (hlstate_active) {
|
if (hlstate_active) {
|
||||||
|
@@ -62,10 +62,10 @@ int get_indent_buf(buf_T *buf, linenr_T lnum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Count the size (in window cells) of the indent in line "ptr", with
|
/// Count the size (in window cells) of the indent in line "ptr", with
|
||||||
// 'tabstop' at "ts".
|
/// 'tabstop' at "ts".
|
||||||
// If @param list is TRUE, count only screen size for tabs.
|
/// If @param list is true, count only screen size for tabs.
|
||||||
int get_indent_str(const char_u *ptr, int ts, int list)
|
int get_indent_str(const char_u *ptr, int ts, bool list)
|
||||||
FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -91,9 +91,9 @@ int get_indent_str(const char_u *ptr, int ts, int list)
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Count the size (in window cells) of the indent in line "ptr", using
|
/// Count the size (in window cells) of the indent in line "ptr", using
|
||||||
// variable tabstops.
|
/// variable tabstops.
|
||||||
// if "list" is true, count only screen size for tabs.
|
/// if "list" is true, count only screen size for tabs.
|
||||||
int get_indent_str_vtab(const char_u *ptr, long ts, long *vts, bool list)
|
int get_indent_str_vtab(const char_u *ptr, long ts, long *vts, bool list)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
@@ -543,7 +543,7 @@ unsigned int trans_special(const char_u **srcp, const size_t src_len,
|
|||||||
|
|
||||||
/// Put the character sequence for "key" with "modifiers" into "dst" and return
|
/// Put the character sequence for "key" with "modifiers" into "dst" and return
|
||||||
/// the resulting length.
|
/// the resulting length.
|
||||||
/// When "keycode" is TRUE prefer key code, e.g. K_DEL instead of DEL.
|
/// When "keycode" is true prefer key code, e.g. K_DEL instead of DEL.
|
||||||
/// The sequence is not NUL terminated.
|
/// The sequence is not NUL terminated.
|
||||||
/// This is how characters in a string are encoded.
|
/// This is how characters in a string are encoded.
|
||||||
unsigned int special_to_buf(int key, int modifiers, bool keycode, char_u *dst)
|
unsigned int special_to_buf(int key, int modifiers, bool keycode, char_u *dst)
|
||||||
|
@@ -2354,10 +2354,8 @@ int convert_setup(vimconv_T *vcp, char_u *from, char_u *to)
|
|||||||
return convert_setup_ext(vcp, from, true, to, true);
|
return convert_setup_ext(vcp, from, true, to, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// As convert_setup(), but only when from_unicode_is_utf8 is true will all
|
||||||
* As convert_setup(), but only when from_unicode_is_utf8 is TRUE will all
|
/// "from" unicode charsets be considered utf-8. Same for "to".
|
||||||
* "from" unicode charsets be considered utf-8. Same for "to".
|
|
||||||
*/
|
|
||||||
int convert_setup_ext(vimconv_T *vcp, char_u *from, bool from_unicode_is_utf8,
|
int convert_setup_ext(vimconv_T *vcp, char_u *from, bool from_unicode_is_utf8,
|
||||||
char_u *to, bool to_unicode_is_utf8)
|
char_u *to, bool to_unicode_is_utf8)
|
||||||
{
|
{
|
||||||
|
@@ -101,7 +101,7 @@ typedef struct memfile {
|
|||||||
blocknr_T mf_neg_count; /// number of negative blocks numbers
|
blocknr_T mf_neg_count; /// number of negative blocks numbers
|
||||||
blocknr_T mf_infile_count; /// number of pages in the file
|
blocknr_T mf_infile_count; /// number of pages in the file
|
||||||
unsigned mf_page_size; /// number of bytes in a page
|
unsigned mf_page_size; /// number of bytes in a page
|
||||||
bool mf_dirty; /// TRUE if there are dirty blocks
|
bool mf_dirty; /// true if there are dirty blocks
|
||||||
} memfile_T;
|
} memfile_T;
|
||||||
|
|
||||||
#endif // NVIM_MEMFILE_DEFS_H
|
#endif // NVIM_MEMFILE_DEFS_H
|
||||||
|
@@ -750,8 +750,8 @@ get_number (
|
|||||||
stuffcharReadbuff(':');
|
stuffcharReadbuff(':');
|
||||||
if (!exmode_active)
|
if (!exmode_active)
|
||||||
cmdline_row = msg_row;
|
cmdline_row = msg_row;
|
||||||
skip_redraw = TRUE; /* skip redraw once */
|
skip_redraw = true; // skip redraw once
|
||||||
do_redraw = FALSE;
|
do_redraw = false;
|
||||||
break;
|
break;
|
||||||
} else if (c == Ctrl_C || c == ESC || c == 'q') {
|
} else if (c == Ctrl_C || c == ESC || c == 'q') {
|
||||||
n = 0;
|
n = 0;
|
||||||
|
@@ -570,9 +570,8 @@ static linenr_T find_longest_lnum(void)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Do a horizontal scroll.
|
||||||
/// Do a horizontal scroll. Return TRUE if the cursor moved, FALSE otherwise.
|
/// @return true if the cursor moved, false otherwise.
|
||||||
///
|
|
||||||
bool mouse_scroll_horiz(int dir)
|
bool mouse_scroll_horiz(int dir)
|
||||||
{
|
{
|
||||||
if (curwin->w_p_wrap) {
|
if (curwin->w_p_wrap) {
|
||||||
|
@@ -1340,7 +1340,7 @@ static int normal_check(VimState *state)
|
|||||||
quit_more = false;
|
quit_more = false;
|
||||||
|
|
||||||
// If skip redraw is set (for ":" in wait_return()), don't redraw now.
|
// If skip redraw is set (for ":" in wait_return()), don't redraw now.
|
||||||
// If there is nothing in the stuff_buffer or do_redraw is TRUE,
|
// If there is nothing in the stuff_buffer or do_redraw is true,
|
||||||
// update cursor and redraw.
|
// update cursor and redraw.
|
||||||
if (skip_redraw || exmode_active) {
|
if (skip_redraw || exmode_active) {
|
||||||
skip_redraw = false;
|
skip_redraw = false;
|
||||||
@@ -8147,10 +8147,8 @@ static void nv_event(cmdarg_T *cap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// @return true when 'mousemodel' is set to "popup" or "popup_setpos".
|
||||||
* Return TRUE when 'mousemodel' is set to "popup" or "popup_setpos".
|
static bool mouse_model_popup(void)
|
||||||
*/
|
|
||||||
static int mouse_model_popup(void)
|
|
||||||
{
|
{
|
||||||
return p_mousem[0] == 'p';
|
return p_mousem[0] == 'p';
|
||||||
}
|
}
|
||||||
|
@@ -88,7 +88,7 @@ typedef struct searchstat
|
|||||||
{
|
{
|
||||||
int cur; // current position of found words
|
int cur; // current position of found words
|
||||||
int cnt; // total count of found words
|
int cnt; // total count of found words
|
||||||
int exact_match; // TRUE if matched exactly on specified position
|
bool exact_match; // true if matched exactly on specified position
|
||||||
int incomplete; // 0: search was fully completed
|
int incomplete; // 0: search was fully completed
|
||||||
// 1: recomputing was timed out
|
// 1: recomputing was timed out
|
||||||
// 2: max count exceeded
|
// 2: max count exceeded
|
||||||
|
@@ -115,10 +115,10 @@ static void sign_group_unref(char_u *groupname)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns TRUE if 'sign' is in 'group'.
|
/// @return true if 'sign' is in 'group'.
|
||||||
/// A sign can either be in the global group (sign->group == NULL)
|
/// A sign can either be in the global group (sign->group == NULL)
|
||||||
/// or in a named group. If 'group' is '*', then the sign is part of the group.
|
/// or in a named group. If 'group' is '*', then the sign is part of the group.
|
||||||
int sign_in_group(sign_entry_T *sign, const char_u *group)
|
bool sign_in_group(sign_entry_T *sign, const char_u *group)
|
||||||
{
|
{
|
||||||
return ((group != NULL && STRCMP(group, "*") == 0)
|
return ((group != NULL && STRCMP(group, "*") == 0)
|
||||||
|| (group == NULL && sign->se_group == NULL)
|
|| (group == NULL && sign->se_group == NULL)
|
||||||
|
Reference in New Issue
Block a user