diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2014-11-11 12:13:00 -0500 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2014-11-11 12:13:00 -0500 |
| commit | b027e1ed0c92ed49961ecbd24228967d916c2bbd (patch) | |
| tree | a8acc0594efe3d971cc55f12e6675c68c2fd73ca /src/nvim | |
| parent | e450c541ddfe1266d3d56b594f83ab197e747584 (diff) | |
| parent | 8eddceb14000a33282a493140ef3c008f385a461 (diff) | |
| download | rneovim-b027e1ed0c92ed49961ecbd24228967d916c2bbd.tar.gz rneovim-b027e1ed0c92ed49961ecbd24228967d916c2bbd.tar.bz2 rneovim-b027e1ed0c92ed49961ecbd24228967d916c2bbd.zip | |
Merge pull request #923 from splinterofchaos/normal-bool
Use bool in normal.h and .c.
Diffstat (limited to 'src/nvim')
| -rw-r--r-- | src/nvim/keymap.c | 2 | ||||
| -rw-r--r-- | src/nvim/normal.c | 946 | ||||
| -rw-r--r-- | src/nvim/normal.h | 15 | ||||
| -rw-r--r-- | src/nvim/ops.c | 7 | ||||
| -rw-r--r-- | src/nvim/search.c | 58 | ||||
| -rw-r--r-- | src/nvim/ui.c | 6 |
6 files changed, 518 insertions, 516 deletions
diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c index 963729215b..45977b96ae 100644 --- a/src/nvim/keymap.c +++ b/src/nvim/keymap.c @@ -740,7 +740,7 @@ char_u *get_key_name(int i) * Look up the given mouse code to return the relevant information in the other * arguments. Return which button is down or was released. */ -int get_mouse_button(int code, int *is_click, int *is_drag) +int get_mouse_button(int code, bool *is_click, bool *is_drag) { int i; diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 5d9af0cf34..829c762c51 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -127,33 +127,33 @@ static const struct nv_cmd { {NUL, nv_error, 0, 0}, {Ctrl_A, nv_addsub, 0, 0}, {Ctrl_B, nv_page, NV_STS, BACKWARD}, - {Ctrl_C, nv_esc, 0, TRUE}, + {Ctrl_C, nv_esc, 0, true}, {Ctrl_D, nv_halfpage, 0, 0}, - {Ctrl_E, nv_scroll_line, 0, TRUE}, + {Ctrl_E, nv_scroll_line, 0, true}, {Ctrl_F, nv_page, NV_STS, FORWARD}, {Ctrl_G, nv_ctrlg, 0, 0}, {Ctrl_H, nv_ctrlh, 0, 0}, {Ctrl_I, nv_pcmark, 0, 0}, - {NL, nv_down, 0, FALSE}, + {NL, nv_down, 0, false}, {Ctrl_K, nv_error, 0, 0}, {Ctrl_L, nv_clear, 0, 0}, - {Ctrl_M, nv_down, 0, TRUE}, - {Ctrl_N, nv_down, NV_STS, FALSE}, + {Ctrl_M, nv_down, 0, true}, + {Ctrl_N, nv_down, NV_STS, false}, {Ctrl_O, nv_ctrlo, 0, 0}, - {Ctrl_P, nv_up, NV_STS, FALSE}, - {Ctrl_Q, nv_visual, 0, FALSE}, + {Ctrl_P, nv_up, NV_STS, false}, + {Ctrl_Q, nv_visual, 0, false}, {Ctrl_R, nv_redo, 0, 0}, {Ctrl_S, nv_ignore, 0, 0}, {Ctrl_T, nv_tagpop, NV_NCW, 0}, {Ctrl_U, nv_halfpage, 0, 0}, - {Ctrl_V, nv_visual, 0, FALSE}, - {'V', nv_visual, 0, FALSE}, - {'v', nv_visual, 0, FALSE}, + {Ctrl_V, nv_visual, 0, false}, + {'V', nv_visual, 0, false}, + {'v', nv_visual, 0, false}, {Ctrl_W, nv_window, 0, 0}, {Ctrl_X, nv_addsub, 0, 0}, - {Ctrl_Y, nv_scroll_line, 0, FALSE}, + {Ctrl_Y, nv_scroll_line, 0, false}, {Ctrl_Z, nv_suspend, 0, 0}, - {ESC, nv_esc, 0, FALSE}, + {ESC, nv_esc, 0, false}, {Ctrl_BSL, nv_normal, NV_NCH_ALW, 0}, {Ctrl_RSB, nv_ident, NV_NCW, 0}, {Ctrl_HAT, nv_hat, NV_NCW, 0}, @@ -165,15 +165,15 @@ static const struct nv_cmd { {'$', nv_dollar, 0, 0}, {'%', nv_percent, 0, 0}, {'&', nv_optrans, 0, 0}, - {'\'', nv_gomark, NV_NCH_ALW, TRUE}, + {'\'', nv_gomark, NV_NCH_ALW, true}, {'(', nv_brace, 0, BACKWARD}, {')', nv_brace, 0, FORWARD}, {'*', nv_ident, 0, 0}, - {'+', nv_down, 0, TRUE}, - {',', nv_csearch, 0, TRUE}, - {'-', nv_up, 0, TRUE}, + {'+', nv_down, 0, true}, + {',', nv_csearch, 0, true}, + {'-', nv_up, 0, true}, {'.', nv_dot, NV_KEEPREG, 0}, - {'/', nv_search, 0, FALSE}, + {'/', nv_search, 0, false}, {'0', nv_beginline, 0, 0}, {'1', nv_ignore, 0, 0}, {'2', nv_ignore, 0, 0}, @@ -185,19 +185,19 @@ static const struct nv_cmd { {'8', nv_ignore, 0, 0}, {'9', nv_ignore, 0, 0}, {':', nv_colon, 0, 0}, - {';', nv_csearch, 0, FALSE}, + {';', nv_csearch, 0, false}, {'<', nv_operator, NV_RL, 0}, {'=', nv_operator, 0, 0}, {'>', nv_operator, NV_RL, 0}, - {'?', nv_search, 0, FALSE}, - {'@', nv_at, NV_NCH_NOP, FALSE}, + {'?', nv_search, 0, false}, + {'@', nv_at, NV_NCH_NOP, false}, {'A', nv_edit, 0, 0}, {'B', nv_bck_word, 0, 1}, {'C', nv_abbrev, NV_KEEPREG, 0}, {'D', nv_abbrev, NV_KEEPREG, 0}, - {'E', nv_wordcmd, 0, TRUE}, + {'E', nv_wordcmd, 0, true}, {'F', nv_csearch, NV_NCH_ALW|NV_LANG, BACKWARD}, - {'G', nv_goto, 0, TRUE}, + {'G', nv_goto, 0, true}, {'H', nv_scroll, 0, 0}, {'I', nv_edit, 0, 0}, {'J', nv_join, 0, 0}, @@ -208,11 +208,11 @@ static const struct nv_cmd { {'O', nv_open, 0, 0}, {'P', nv_put, 0, 0}, {'Q', nv_exmode, NV_NCW, 0}, - {'R', nv_Replace, 0, FALSE}, + {'R', nv_Replace, 0, false}, {'S', nv_subst, NV_KEEPREG, 0}, {'T', nv_csearch, NV_NCH_ALW|NV_LANG, BACKWARD}, {'U', nv_Undo, 0, 0}, - {'W', nv_wordcmd, 0, TRUE}, + {'W', nv_wordcmd, 0, true}, {'X', nv_abbrev, NV_KEEPREG, 0}, {'Y', nv_abbrev, NV_KEEPREG, 0}, {'Z', nv_Zet, NV_NCH_NOP|NV_NCW, 0}, @@ -221,18 +221,18 @@ static const struct nv_cmd { {']', nv_brackets, NV_NCH_ALW, FORWARD}, {'^', nv_beginline, 0, BL_WHITE | BL_FIX}, {'_', nv_lineop, 0, 0}, - {'`', nv_gomark, NV_NCH_ALW, FALSE}, + {'`', nv_gomark, NV_NCH_ALW, false}, {'a', nv_edit, NV_NCH, 0}, {'b', nv_bck_word, 0, 0}, {'c', nv_operator, 0, 0}, {'d', nv_operator, 0, 0}, - {'e', nv_wordcmd, 0, FALSE}, + {'e', nv_wordcmd, 0, false}, {'f', nv_csearch, NV_NCH_ALW|NV_LANG, FORWARD}, - {'g', nv_g_cmd, NV_NCH_ALW, FALSE}, + {'g', nv_g_cmd, NV_NCH_ALW, false}, {'h', nv_left, NV_RL, 0}, {'i', nv_edit, NV_NCH, 0}, - {'j', nv_down, 0, FALSE}, - {'k', nv_up, 0, FALSE}, + {'j', nv_down, 0, false}, + {'k', nv_up, 0, false}, {'l', nv_right, NV_RL, 0}, {'m', nv_mark, NV_NCH_NOP, 0}, {'n', nv_next, 0, 0}, @@ -243,7 +243,7 @@ static const struct nv_cmd { {'s', nv_subst, NV_KEEPREG, 0}, {'t', nv_csearch, NV_NCH_ALW|NV_LANG, FORWARD}, {'u', nv_undo, 0, 0}, - {'w', nv_wordcmd, 0, FALSE}, + {'w', nv_wordcmd, 0, false}, {'x', nv_abbrev, NV_KEEPREG, 0}, {'y', nv_operator, 0, 0}, {'z', nv_zet, NV_NCH_ALW, 0}, @@ -280,28 +280,28 @@ static const struct nv_cmd { {K_INS, nv_edit, 0, 0}, {K_KINS, nv_edit, 0, 0}, {K_BS, nv_ctrlh, 0, 0}, - {K_UP, nv_up, NV_SSS|NV_STS, FALSE}, + {K_UP, nv_up, NV_SSS|NV_STS, false}, {K_S_UP, nv_page, NV_SS, BACKWARD}, - {K_DOWN, nv_down, NV_SSS|NV_STS, FALSE}, + {K_DOWN, nv_down, NV_SSS|NV_STS, false}, {K_S_DOWN, nv_page, NV_SS, FORWARD}, {K_LEFT, nv_left, NV_SSS|NV_STS|NV_RL, 0}, {K_S_LEFT, nv_bck_word, NV_SS|NV_RL, 0}, {K_C_LEFT, nv_bck_word, NV_SSS|NV_RL|NV_STS, 1}, {K_RIGHT, nv_right, NV_SSS|NV_STS|NV_RL, 0}, - {K_S_RIGHT, nv_wordcmd, NV_SS|NV_RL, FALSE}, - {K_C_RIGHT, nv_wordcmd, NV_SSS|NV_RL|NV_STS, TRUE}, + {K_S_RIGHT, nv_wordcmd, NV_SS|NV_RL, false}, + {K_C_RIGHT, nv_wordcmd, NV_SSS|NV_RL|NV_STS, true}, {K_PAGEUP, nv_page, NV_SSS|NV_STS, BACKWARD}, {K_KPAGEUP, nv_page, NV_SSS|NV_STS, BACKWARD}, {K_PAGEDOWN, nv_page, NV_SSS|NV_STS, FORWARD}, {K_KPAGEDOWN, nv_page, NV_SSS|NV_STS, FORWARD}, - {K_END, nv_end, NV_SSS|NV_STS, FALSE}, - {K_KEND, nv_end, NV_SSS|NV_STS, FALSE}, - {K_S_END, nv_end, NV_SS, FALSE}, - {K_C_END, nv_end, NV_SSS|NV_STS, TRUE}, + {K_END, nv_end, NV_SSS|NV_STS, false}, + {K_KEND, nv_end, NV_SSS|NV_STS, false}, + {K_S_END, nv_end, NV_SS, false}, + {K_C_END, nv_end, NV_SSS|NV_STS, true}, {K_HOME, nv_home, NV_SSS|NV_STS, 0}, {K_KHOME, nv_home, NV_SSS|NV_STS, 0}, {K_S_HOME, nv_home, NV_SS, 0}, - {K_C_HOME, nv_goto, NV_SSS|NV_STS, FALSE}, + {K_C_HOME, nv_goto, NV_SSS|NV_STS, false}, {K_DEL, nv_abbrev, 0, 0}, {K_KDEL, nv_abbrev, 0, 0}, {K_UNDO, nv_kundo, 0, 0}, @@ -416,19 +416,19 @@ static int find_command(int cmdchar) void normal_cmd ( oparg_T *oap, - int toplevel /* TRUE when called from main() */ + bool toplevel /* true when called from main() */ ) { cmdarg_T ca; /* command arguments */ int c; - int ctrl_w = FALSE; /* got CTRL-W command */ + bool ctrl_w = false; /* got CTRL-W command */ int old_col = curwin->w_curswant; - int need_flushbuf; /* need to call out_flush() */ + bool need_flushbuf; /* need to call out_flush() */ pos_T old_pos; /* cursor position before command */ int mapped_len; static int old_mapped_len = 0; int idx; - int set_prevcount = FALSE; + bool set_prevcount = false; memset(&ca, 0, sizeof(ca)); /* also resets ca.retval */ ca.oap = oap; @@ -454,7 +454,7 @@ normal_cmd ( * count. */ if (!finish_op && !oap->regname) { ca.opcount = 0; - set_prevcount = TRUE; + set_prevcount = true; } /* Restore counts from before receiving K_CURSORHOLD. This means after @@ -471,7 +471,7 @@ normal_cmd ( State = NORMAL_BUSY; #ifdef USE_ON_FLY_SCROLL - dont_scroll = FALSE; /* allow scrolling here */ + dont_scroll = false; /* allow scrolling here */ #endif /* Set v:count here, when called from main() and not a stuffed @@ -484,7 +484,7 @@ normal_cmd ( * Get the command character from the user. */ c = safe_vgetc(); - LANGMAP_ADJUST(c, TRUE); + LANGMAP_ADJUST(c, true); /* * If a mapping was started in Visual or Select mode, remember the length @@ -516,7 +516,7 @@ normal_cmd ( c = 'd'; else c = 'c'; - msg_nowait = TRUE; /* don't delay going to insert mode */ + msg_nowait = true; /* don't delay going to insert mode */ old_mapped_len = 0; /* do go to Insert mode */ } @@ -550,7 +550,7 @@ getcount: } ++no_zero_mapping; /* don't map zero here */ c = plain_vgetc(); - LANGMAP_ADJUST(c, TRUE); + LANGMAP_ADJUST(c, true); --no_zero_mapping; if (ctrl_w) { --no_mapping; @@ -563,13 +563,13 @@ getcount: * If we got CTRL-W there may be a/another count */ if (c == Ctrl_W && !ctrl_w && oap->op_type == OP_NOP) { - ctrl_w = TRUE; + ctrl_w = true; ca.opcount = ca.count0; /* remember first count */ ca.count0 = 0; ++no_mapping; ++allow_keys; /* no mapping for nchar, but keys */ c = plain_vgetc(); /* get next character */ - LANGMAP_ADJUST(c, TRUE); + LANGMAP_ADJUST(c, true); --no_mapping; --allow_keys; need_flushbuf |= add_to_showcmd(c); @@ -704,39 +704,39 @@ getcount: || VIsual_active )))) { int *cp; - int repl = FALSE; /* get character for replace mode */ - int lit = FALSE; /* get extra character literally */ - int langmap_active = FALSE; /* using :lmap mappings */ + bool repl = false; /* get character for replace mode */ + bool lit = false; /* get extra character literally */ + bool langmap_active = false; /* using :lmap mappings */ int lang; /* getting a text character */ #ifdef USE_IM_CONTROL - int save_smd; /* saved value of p_smd */ + bool save_smd; /* saved value of p_smd */ #endif ++no_mapping; ++allow_keys; /* no mapping for nchar, but allow key codes */ /* Don't generate a CursorHold event here, most commands can't handle * it, e.g., nv_replace(), nv_csearch(). */ - did_cursorhold = TRUE; + did_cursorhold = true; if (ca.cmdchar == 'g') { /* * For 'g' get the next character now, so that we can check for * "gr", "g'" and "g`". */ ca.nchar = plain_vgetc(); - LANGMAP_ADJUST(ca.nchar, TRUE); + LANGMAP_ADJUST(ca.nchar, true); need_flushbuf |= add_to_showcmd(ca.nchar); if (ca.nchar == 'r' || ca.nchar == '\'' || ca.nchar == '`' || ca.nchar == Ctrl_BSL) { cp = &ca.extra_char; /* need to get a third character */ if (ca.nchar != 'r') - lit = TRUE; /* get it literally */ + lit = true; /* get it literally */ else - repl = TRUE; /* get it in replace mode */ + repl = true; /* get it in replace mode */ } else cp = NULL; /* no third character needed */ } else { if (ca.cmdchar == 'r') /* get it in replace mode */ - repl = TRUE; + repl = true; cp = &ca.nchar; } lang = (repl || (nv_cmds[idx].cmd_flags & NV_LANG)); @@ -757,13 +757,13 @@ getcount: State = LREPLACE; else State = LANGMAP; - langmap_active = TRUE; + langmap_active = true; } #ifdef USE_IM_CONTROL save_smd = p_smd; - p_smd = FALSE; /* Don't let the IM code show the mode here */ + p_smd = false; /* Don't let the IM code show the mode here */ if (lang && curbuf->b_p_iminsert == B_IMODE_IM) - im_set_active(TRUE); + im_set_active(true); #endif *cp = plain_vgetc(); @@ -778,7 +778,7 @@ getcount: if (lang) { if (curbuf->b_p_iminsert != B_IMODE_LMAP) im_save_status(&curbuf->b_p_iminsert); - im_set_active(FALSE); + im_set_active(false); } p_smd = save_smd; #endif @@ -791,7 +791,7 @@ getcount: && ((nv_cmds[idx].cmd_flags & NV_LANG) || cp == &ca.extra_char) && vim_strchr(p_cpo, CPO_DIGRAPH) == NULL) { - c = get_digraph(FALSE); + c = get_digraph(false); if (c > 0) { *cp = c; /* Guessing how to update showcmd here... */ @@ -875,7 +875,7 @@ getcount: if (need_flushbuf) out_flush(); if (ca.cmdchar != K_IGNORE) - did_cursorhold = FALSE; + did_cursorhold = false; State = NORMAL; @@ -887,7 +887,7 @@ getcount: } if (ca.cmdchar != K_IGNORE) { - msg_didout = FALSE; /* don't scroll screen up for normal command */ + msg_didout = false; /* don't scroll screen up for normal command */ msg_col = 0; } @@ -940,7 +940,7 @@ getcount: /* * If an operation is pending, handle it... */ - do_pending_operator(&ca, old_col, FALSE); + do_pending_operator(&ca, old_col, false); /* * Wait for a moment when a message is displayed that will be overwritten @@ -1005,8 +1005,8 @@ getcount: ui_delay(3000L, false); /* wait up to three seconds */ State = save_State; - msg_scroll = FALSE; - emsg_on_display = FALSE; + msg_scroll = false; + emsg_on_display = false; } /* @@ -1014,11 +1014,11 @@ getcount: */ normal_end: - msg_nowait = FALSE; + msg_nowait = false; /* Reset finish_op, in case it was set */ c = finish_op; - finish_op = FALSE; + finish_op = false; /* Redraw the cursor with another shape, if we were in Operator-pending * mode or did a replace command. */ if (c || ca.cmdchar == 'r') { @@ -1038,7 +1038,7 @@ normal_end: if (curwin->w_p_scb && toplevel) { validate_cursor(); /* may need to update w_leftcol */ - do_check_scrollbind(TRUE); + do_check_scrollbind(true); } if (curwin->w_p_crb && toplevel) { @@ -1058,14 +1058,14 @@ normal_end: && stuff_empty() && oap->regname == 0) { if (restart_VIsual_select == 1) { - VIsual_select = TRUE; + VIsual_select = true; showmode(); restart_VIsual_select = 0; } if (restart_edit != 0 && !VIsual_active && old_mapped_len == 0 ) - (void)edit(restart_edit, FALSE, 1L); + (void)edit(restart_edit, false, 1L); } if (restart_VIsual_select == 2) @@ -1077,9 +1077,9 @@ normal_end: /* * Set v:count and v:count1 according to "cap". - * Set v:prevcount only when "set_prevcount" is TRUE. + * Set v:prevcount only when "set_prevcount" is true. */ -static void set_vcount_ca(cmdarg_T *cap, int *set_prevcount) +static void set_vcount_ca(cmdarg_T *cap, bool *set_prevcount) { long count = cap->count0; @@ -1087,17 +1087,17 @@ static void set_vcount_ca(cmdarg_T *cap, int *set_prevcount) if (cap->opcount != 0) count = cap->opcount * (count == 0 ? 1 : count); set_vcount(count, count == 0 ? 1 : count, *set_prevcount); - *set_prevcount = FALSE; /* only set v:prevcount once */ + *set_prevcount = false; /* only set v:prevcount once */ } /* * Handle an operator after visual mode or when the movement is finished */ -void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) +void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank) { oparg_T *oap = cap->oap; pos_T old_cursor; - int empty_region_error; + bool empty_region_error; int restart_edit_save; /* The visual area is remembered for redo */ @@ -1105,7 +1105,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) static linenr_T redo_VIsual_line_count; /* number of lines */ static colnr_T redo_VIsual_vcol; /* number of cols or end column */ static long redo_VIsual_count; /* count for Visual operator */ - int include_line_break = FALSE; + bool include_line_break = false; old_cursor = curwin->w_cursor; @@ -1122,18 +1122,18 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) /* If the motion was linewise, "inclusive" will not have been set. * Use "exclusive" to be consistent. Makes "dvj" work nice. */ if (oap->motion_type == MLINE) - oap->inclusive = FALSE; + oap->inclusive = false; /* If the motion already was characterwise, toggle "inclusive" */ else if (oap->motion_type == MCHAR) oap->inclusive = !oap->inclusive; oap->motion_type = MCHAR; } else if (oap->motion_force == Ctrl_V) { /* Change line- or characterwise motion into Visual block mode. */ - VIsual_active = TRUE; + VIsual_active = true; VIsual = oap->start; VIsual_mode = Ctrl_V; - VIsual_select = FALSE; - VIsual_reselect = FALSE; + VIsual_select = false; + VIsual_reselect = false; } /* Only redo yank when 'y' flag is in 'cpoptions'. */ @@ -1285,7 +1285,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) if (VIsual_mode == Ctrl_V) { /* block mode */ colnr_T start, end; - oap->block_mode = TRUE; + oap->block_mode = true; getvvcol(curwin, &(oap->start), &oap->start_vcol, NULL, &oap->end_vcol); @@ -1389,12 +1389,12 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) } /* - * oap->inclusive defaults to TRUE. + * oap->inclusive defaults to true. * If oap->end is on a NUL (empty line) oap->inclusive becomes - * FALSE. This makes "d}P" and "v}dP" work the same. + * false. This makes "d}P" and "v}dP" work the same. */ if (oap->motion_force == NUL || oap->motion_type == MLINE) - oap->inclusive = TRUE; + oap->inclusive = true; if (VIsual_mode == 'V') oap->motion_type = MLINE; else { @@ -1402,7 +1402,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) if (VIsual_mode != Ctrl_V && *ml_get_pos(&(oap->end)) == NUL && (include_line_break || !virtual_op) ) { - oap->inclusive = FALSE; + oap->inclusive = false; /* Try to include the newline, unless it's an operator * that works on lines only. */ if (*p_sel != 'o' && !op_on_lines(oap->op_type)) { @@ -1415,13 +1415,13 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) /* Cannot move below the last line, make the op * inclusive to tell the operation to include the * line break. */ - oap->inclusive = TRUE; + oap->inclusive = true; } } } } - redo_VIsual_busy = FALSE; + redo_VIsual_busy = false; /* * Switch Visual off now, so screen updating does @@ -1431,11 +1431,11 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) * part. */ if (!gui_yank) { - VIsual_active = FALSE; + VIsual_active = false; setmouse(); mouse_dragging = 0; if (mode_displayed) - clear_cmdline = TRUE; /* unshow visual mode later */ + clear_cmdline = true; /* unshow visual mode later */ else clear_showcmd(); if ((oap->op_type == OP_YANK @@ -1455,7 +1455,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) if (l > 1) oap->end.col += l - 1; } - curwin->w_set_curswant = TRUE; + curwin->w_set_curswant = true; /* * oap->empty is set when start and end are the same. The inclusive @@ -1484,19 +1484,19 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) /* * If the end of an operator is in column one while oap->motion_type - * is MCHAR and oap->inclusive is FALSE, we put op_end after the last + * is MCHAR and oap->inclusive is false, we put op_end after the last * character in the previous line. If op_start is on or before the * first non-blank in the line, the operator becomes linewise * (strange, but that's the way vi does it). */ if ( oap->motion_type == MCHAR - && oap->inclusive == FALSE + && oap->inclusive == false && !(cap->retval & CA_NO_ADJ_OP_END) && oap->end.col == 0 && (!oap->is_VIsual || *p_sel == 'o') && !oap->block_mode && oap->line_count > 1) { - oap->end_adjusted = TRUE; /* remember that we did this */ + oap->end_adjusted = true; /* remember that we did this */ --oap->line_count; --oap->end.lnum; if (inindent(0)) @@ -1505,19 +1505,19 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) oap->end.col = (colnr_T)STRLEN(ml_get(oap->end.lnum)); if (oap->end.col) { --oap->end.col; - oap->inclusive = TRUE; + oap->inclusive = true; } } } else - oap->end_adjusted = FALSE; + oap->end_adjusted = false; switch (oap->op_type) { case OP_LSHIFT: case OP_RSHIFT: - op_shift(oap, TRUE, + op_shift(oap, true, oap->is_VIsual ? (int)cap->count1 : 1); - auto_format(FALSE, TRUE); + auto_format(false, true); break; case OP_JOIN_NS: @@ -1528,13 +1528,13 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) curbuf->b_ml.ml_line_count) beep_flush(); else { - do_join(oap->line_count, oap->op_type == OP_JOIN, TRUE, TRUE, true); - auto_format(FALSE, TRUE); + do_join(oap->line_count, oap->op_type == OP_JOIN, true, true, true); + auto_format(false, true); } break; case OP_DELETE: - VIsual_reselect = FALSE; /* don't reselect now */ + VIsual_reselect = false; /* don't reselect now */ if (empty_region_error) { vim_beep(); CancelRedo(); @@ -1542,7 +1542,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) (void)op_delete(oap); if (oap->motion_type == MLINE && has_format_option(FO_AUTO)) u_save_cursor(); /* cursor line wasn't saved yet */ - auto_format(FALSE, TRUE); + auto_format(false, true); } break; @@ -1553,12 +1553,12 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) CancelRedo(); } } else - (void)op_yank(oap, FALSE, !gui_yank); + (void)op_yank(oap, false, !gui_yank); check_cursor_col(); break; case OP_CHANGE: - VIsual_reselect = FALSE; /* don't reselect now */ + VIsual_reselect = false; /* don't reselect now */ if (empty_region_error) { vim_beep(); CancelRedo(); @@ -1573,7 +1573,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) restart_edit_save = 0; restart_edit = 0; /* Reset finish_op now, don't want it set inside edit(). */ - finish_op = FALSE; + finish_op = false; if (op_change(oap)) /* will call edit() */ cap->retval |= CA_COMMAND_BUSY; if (restart_edit == 0) @@ -1585,7 +1585,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) if (vim_strchr(p_cpo, CPO_FILTER) != NULL) AppendToRedobuff((char_u *)"!\r"); /* use any last used !cmd */ else - bangredo = TRUE; /* do_bang() will put cmd in redo buffer */ + bangredo = true; /* do_bang() will put cmd in redo buffer */ case OP_INDENT: case OP_COLON: @@ -1625,11 +1625,11 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) else if (*p_fp != NUL) op_colon(oap); /* use external command */ else - op_format(oap, FALSE); /* use internal function */ + op_format(oap, false); /* use internal function */ break; case OP_FORMAT2: - op_format(oap, TRUE); /* use internal function */ + op_format(oap, true); /* use internal function */ break; case OP_FUNCTION: @@ -1638,7 +1638,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) case OP_INSERT: case OP_APPEND: - VIsual_reselect = FALSE; /* don't reselect now */ + VIsual_reselect = false; /* don't reselect now */ if (empty_region_error) { vim_beep(); CancelRedo(); @@ -1653,7 +1653,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) /* TODO: when inserting in several lines, should format all * the lines. */ - auto_format(FALSE, TRUE); + auto_format(false, true); if (restart_edit == 0) restart_edit = restart_edit_save; @@ -1661,7 +1661,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) break; case OP_REPLACE: - VIsual_reselect = FALSE; /* don't reselect now */ + VIsual_reselect = false; /* don't reselect now */ if (empty_region_error) { vim_beep(); CancelRedo(); @@ -1670,7 +1670,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) break; case OP_FOLD: - VIsual_reselect = FALSE; /* don't reselect now */ + VIsual_reselect = false; /* don't reselect now */ foldCreate(oap->start.lnum, oap->end.lnum); break; @@ -1678,7 +1678,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) case OP_FOLDOPENREC: case OP_FOLDCLOSE: case OP_FOLDCLOSEREC: - VIsual_reselect = FALSE; /* don't reselect now */ + VIsual_reselect = false; /* don't reselect now */ opFoldRange(oap->start.lnum, oap->end.lnum, oap->op_type == OP_FOLDOPEN || oap->op_type == OP_FOLDOPENREC, @@ -1689,7 +1689,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) case OP_FOLDDEL: case OP_FOLDDELREC: - VIsual_reselect = FALSE; /* don't reselect now */ + VIsual_reselect = false; /* don't reselect now */ deleteFold(oap->start.lnum, oap->end.lnum, oap->op_type == OP_FOLDDELREC, oap->is_VIsual); break; @@ -1708,7 +1708,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) } else { curwin->w_cursor = old_cursor; } - oap->block_mode = FALSE; + oap->block_mode = false; clearop(oap); } } @@ -1789,7 +1789,7 @@ static void op_function(oparg_T *oap) * function. */ virtual_op = MAYBE; - (void)call_func_retnr(p_opfunc, 1, argv, FALSE); + (void)call_func_retnr(p_opfunc, 1, argv, false); virtual_op = save_virtual_op; } @@ -1829,29 +1829,29 @@ static void op_function(oparg_T *oap) * (1) only if mouse pointer moved since press * (2) only if click is in same buffer * - * Return TRUE if start_arrow() should be called for edit mode. + * Return true if start_arrow() should be called for edit mode. */ -int +bool do_mouse ( oparg_T *oap, /* operator argument, can be NULL */ int c, /* K_LEFTMOUSE, etc */ int dir, /* Direction to 'put' if necessary */ long count, - int fixindent /* PUT_FIXINDENT if fixing indent necessary */ + bool fixindent /* PUT_FIXINDENT if fixing indent necessary */ ) { - static int do_always = FALSE; /* ignore 'mouse' setting next time */ - static int got_click = FALSE; /* got a click some time back */ + static bool do_always = false; /* ignore 'mouse' setting next time */ + static bool got_click = false; /* got a click some time back */ int which_button; /* MOUSE_LEFT, _MIDDLE or _RIGHT */ - int is_click; /* If FALSE it's a drag or release event */ - int is_drag; /* If TRUE it's a drag event */ + bool is_click; /* If false it's a drag or release event */ + bool is_drag; /* If true it's a drag event */ int jump_flags = 0; /* flags for jump_to_mouse() */ pos_T start_visual; - int moved; /* Has cursor moved? */ - int in_status_line; /* mouse in status line */ - static int in_tab_line = FALSE; /* mouse clicked in tab line */ - int in_sep_line; /* mouse in vertical separator line */ + bool moved; /* Has cursor moved? */ + bool in_status_line; /* mouse in status line */ + static bool in_tab_line = false; /* mouse clicked in tab line */ + bool in_sep_line; /* mouse in vertical separator line */ int c1, c2; pos_T save_cursor; win_T *old_curwin = curwin; @@ -1873,13 +1873,13 @@ do_mouse ( * do_mouse(). */ if (do_always) - do_always = FALSE; + do_always = false; else { if (VIsual_active) { if (!mouse_has(MOUSE_VISUAL)) - return FALSE; + return false; } else if (State == NORMAL && !mouse_has(MOUSE_NORMAL)) - return FALSE; + return false; } for (;; ) { @@ -1910,15 +1910,15 @@ do_mouse ( * Ignore drag and release events if we didn't get a click. */ if (is_click) - got_click = TRUE; + got_click = true; else { if (!got_click) /* didn't get click, ignore */ - return FALSE; + return false; if (!is_drag) { /* release, reset got_click */ - got_click = FALSE; + got_click = false; if (in_tab_line) { - in_tab_line = FALSE; - return FALSE; + in_tab_line = false; + return false; } } } @@ -1933,15 +1933,15 @@ do_mouse ( if (count > 1) stuffnumReadbuff(count); stuffcharReadbuff(Ctrl_T); - got_click = FALSE; /* ignore drag&release now */ - return FALSE; + got_click = false; /* ignore drag&release now */ + return false; } /* * CTRL only works with left mouse button */ if ((mod_mask & MOD_MASK_CTRL) && which_button != MOUSE_LEFT) |