diff options
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r-- | src/nvim/edit.c | 70 |
1 files changed, 33 insertions, 37 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index f39a6a281b..5410343365 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -174,8 +174,7 @@ static int compl_enter_selects = FALSE; * are used. */ static char_u *compl_leader = NULL; -static int compl_get_longest = FALSE; /* put longest common string - in compl_leader */ +static bool compl_get_longest = false; // put longest common string in compl_leader static int compl_no_insert = FALSE; /* FALSE: select & insert 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 expand_T compl_xp; -static int compl_opt_refresh_always = FALSE; +static bool compl_opt_refresh_always = false; 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 last_match_pos; 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. 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 *dict = NULL; int dict_f = 0; - int set_match_pos; + bool set_match_pos; int l_ctrl_x_mode = ctrl_x_mode; assert(curbuf != NULL); @@ -4136,7 +4135,7 @@ static int ins_compl_get_exp(pos_T *ini) FOR_ALL_BUFFERS(buf) { buf->b_scanned = false; } - found_all = FALSE; + found_all = false; ins_buf = curbuf; e_cpt = (compl_cont_status & CONT_LOCAL) ? (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 (;; ) { found_new_match = FAIL; - set_match_pos = FALSE; + set_match_pos = false; 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 || CTRL_X_MODE_LINE_OR_EVAL(l_ctrl_x_mode)) && (!compl_started || found_all)) { - found_all = FALSE; + found_all = false; while (*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 (void)copy_option_part(&e_cpt, IObuff, IOSIZE, ","); - found_all = TRUE; + found_all = true; if (type == -1) { continue; } @@ -4397,7 +4396,7 @@ static int ins_compl_get_exp(pos_T *ini) } if (found_new_match == FAIL) { if (ins_buf == curbuf) { - found_all = TRUE; + found_all = true; } break; } @@ -5247,11 +5246,9 @@ static int ins_complete(int c, bool enable_pum) return FAIL; } - /* - * Reset extended parameters of completion, when start new - * completion. - */ - compl_opt_refresh_always = FALSE; + // Reset extended parameters of completion, when start new + // completion. + compl_opt_refresh_always = false; if (col < 0) { col = curs_col; @@ -5532,8 +5529,8 @@ int get_literal(void) int cc; int nc; int i; - int hex = FALSE; - int octal = FALSE; + bool hex = false; + bool octal = false; int unicode = 0; if (got_int) { @@ -5550,9 +5547,9 @@ int get_literal(void) add_to_showcmd(nc); } if (nc == 'x' || nc == 'X') { - hex = TRUE; + hex = true; } else if (nc == 'o' || nc == 'O') { - octal = TRUE; + octal = true; } else if (nc == 'u' || nc == 'U') { unicode = nc; } else { @@ -6329,7 +6326,7 @@ void auto_format(bool trailblank, bool prev_line) /* With the 'c' flag in 'formatoptions' and 't' missing: only format * comments. */ 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; } @@ -6478,7 +6475,8 @@ static void start_arrow(pos_T *end_insert_pos) } /// 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_change end undoable 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) { 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) { start_arrow(&tpos); } @@ -6541,7 +6539,7 @@ int stop_arrow(void) if (Insstart.col > Insstart_orig.col && !ins_need_undo) { // Don't update the original insert position when moved to the // right, except when nothing was inserted yet. - update_Insstart_orig = FALSE; + update_Insstart_orig = false; } 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; char_u *p; char_u *line; - int icase; + bool icase; if (keytyped == NUL) { // 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) { ++look; if (*look == '~') { - icase = TRUE; - ++look; + icase = true; + look++; } else { - icase = FALSE; + icase = false; } p = vim_strchr(look, ','); if (p == NULL) { @@ -7671,7 +7669,7 @@ int hkmap(int c) static void ins_reg(void) { - int need_redraw = FALSE; + bool need_redraw = false; int regname; int literally = 0; int vis_active = VIsual_active; @@ -7783,14 +7781,14 @@ static void ins_ctrl_g(void) case K_UP: case Ctrl_K: case 'k': - ins_up(TRUE); + ins_up(true); break; // CTRL-G j and CTRL-G <Down>: cursor down to Insstart.col case K_DOWN: case Ctrl_J: case 'j': - ins_down(TRUE); + ins_down(true); break; // CTRL-G u: start new undoable edit @@ -9229,7 +9227,7 @@ static void ins_try_si(int c) pos_T *pos, old_pos; char_u *ptr; int i; - int temp; + bool temp; /* * 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); } } else if (curwin->w_cursor.col > 0) { - /* - * when inserting '{' after "O" reduce indent, but not - * more than indent of previous line - */ - temp = TRUE; + // when inserting '{' after "O" reduce indent, but not + // more than indent of previous line + temp = true; if (c == '{' && can_si_back && curwin->w_cursor.lnum > 1) { old_pos = curwin->w_cursor; i = get_indent(); @@ -9283,7 +9279,7 @@ static void ins_try_si(int c) } } if (get_indent() >= i) { - temp = FALSE; + temp = false; } curwin->w_cursor = old_pos; } |