diff options
Diffstat (limited to 'src/normal.c')
-rw-r--r-- | src/normal.c | 490 |
1 files changed, 202 insertions, 288 deletions
diff --git a/src/normal.c b/src/normal.c index c141f468b2..75b9319d95 100644 --- a/src/normal.c +++ b/src/normal.c @@ -13,6 +13,39 @@ */ #include "vim.h" +#include "normal.h" +#include "buffer.h" +#include "charset.h" +#include "diff.h" +#include "digraph.h" +#include "edit.h" +#include "eval.h" +#include "ex_cmds.h" +#include "ex_cmds2.h" +#include "ex_docmd.h" +#include "ex_getln.h" +#include "fileio.h" +#include "fold.h" +#include "getchar.h" +#include "main.h" +#include "mark.h" +#include "memline.h" +#include "message.h" +#include "misc1.h" +#include "misc2.h" +#include "move.h" +#include "ops.h" +#include "option.h" +#include "quickfix.h" +#include "screen.h" +#include "search.h" +#include "spell.h" +#include "syntax.h" +#include "tag.h" +#include "term.h" +#include "ui.h" +#include "undo.h" +#include "window.h" /* * The Visual area is remembered for reselection. @@ -384,9 +417,7 @@ static int nv_max_linear; * Compare functions for qsort() below, that checks the command character * through the index in nv_cmd_idx[]. */ -static int nv_compare(s1, s2) -const void *s1; -const void *s2; +static int nv_compare(const void *s1, const void *s2) { int c1, c2; @@ -403,7 +434,7 @@ const void *s2; /* * Initialize the nv_cmd_idx[] table. */ -void init_normal_cmds() { +void init_normal_cmds(void) { int i; /* Fill the index table with a one to one relation. */ @@ -424,8 +455,7 @@ void init_normal_cmds() { * Search for a command in the commands table. * Returns -1 for invalid command. */ -static int find_command(cmdchar) -int cmdchar; +static int find_command(int cmdchar) { int i; int idx; @@ -470,9 +500,11 @@ int cmdchar; /* * Execute a command in Normal mode. */ -void normal_cmd(oap, toplevel) -oparg_T *oap; -int toplevel UNUSED; /* TRUE when called from main() */ +void +normal_cmd ( + oparg_T *oap, + int toplevel /* TRUE when called from main() */ +) { cmdarg_T ca; /* command arguments */ int c; @@ -1140,9 +1172,7 @@ normal_end: * Set v:count and v:count1 according to "cap". * Set v:prevcount only when "set_prevcount" is TRUE. */ -static void set_vcount_ca(cap, set_prevcount) -cmdarg_T *cap; -int *set_prevcount; +static void set_vcount_ca(cmdarg_T *cap, int *set_prevcount) { long count = cap->count0; @@ -1156,10 +1186,7 @@ int *set_prevcount; /* * Handle an operator after visual mode or when the movement is finished */ -void do_pending_operator(cap, old_col, gui_yank) -cmdarg_T *cap; -int old_col; -int gui_yank; +void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) { oparg_T *oap = cap->oap; pos_T old_cursor; @@ -1782,8 +1809,7 @@ int gui_yank; /* * Handle indent and format operators and visual mode ":". */ -static void op_colon(oap) -oparg_T *oap; +static void op_colon(oparg_T *oap) { stuffcharReadbuff(':'); if (oap->is_VIsual) @@ -1830,8 +1856,7 @@ oparg_T *oap; /* * Handle the "g@" operator: call 'operatorfunc'. */ -static void op_function(oap) -oparg_T *oap UNUSED; +static void op_function(oparg_T *oap) { char_u *(argv[1]); int save_virtual_op = virtual_op; @@ -1899,12 +1924,14 @@ oparg_T *oap UNUSED; * * Return TRUE if start_arrow() should be called for edit mode. */ -int do_mouse(oap, c, dir, count, fixindent) -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 */ +int +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 */ +) { static int do_always = FALSE; /* ignore 'mouse' setting next time */ static int got_click = FALSE; /* got a click some time back */ @@ -2574,8 +2601,7 @@ int fixindent; /* PUT_FIXINDENT if fixing indent necessary */ /* * Move "pos" back to the start of the word it's in. */ -static void find_start_of_word(pos) -pos_T *pos; +static void find_start_of_word(pos_T *pos) { char_u *line; int cclass; @@ -2597,8 +2623,7 @@ pos_T *pos; * Move "pos" forward to the end of the word it's in. * When 'selection' is "exclusive", the position is just after the word. */ -static void find_end_of_word(pos) -pos_T *pos; +static void find_end_of_word(pos_T *pos) { char_u *line; int cclass; @@ -2628,8 +2653,7 @@ pos_T *pos; * 2: normal word character * >2: multi-byte word character. */ -static int get_mouse_class(p) -char_u *p; +static int get_mouse_class(char_u *p) { int c; @@ -2658,7 +2682,7 @@ char_u *p; * Check if highlighting for visual mode is possible, give a warning message * if not. */ -void check_visual_highlight() { +void check_visual_highlight(void) { static int did_check = FALSE; if (full_screen) { @@ -2673,7 +2697,7 @@ void check_visual_highlight() { * This function should ALWAYS be called to end Visual mode, except from * do_pending_operator(). */ -void end_visual_mode() { +void end_visual_mode(void) { VIsual_active = FALSE; setmouse(); @@ -2699,7 +2723,7 @@ void end_visual_mode() { /* * Reset VIsual_active and VIsual_reselect. */ -void reset_VIsual_and_resel() { +void reset_VIsual_and_resel(void) { if (VIsual_active) { end_visual_mode(); redraw_curbuf_later(INVERTED); /* delete the inversion later */ @@ -2710,7 +2734,7 @@ void reset_VIsual_and_resel() { /* * Reset VIsual_active and VIsual_reselect if it's set. */ -void reset_VIsual() { +void reset_VIsual(void) { if (VIsual_active) { end_visual_mode(); redraw_curbuf_later(INVERTED); /* delete the inversion later */ @@ -2739,9 +2763,7 @@ void reset_VIsual() { * If a string is found, a pointer to the string is put in "*string". This * string is not always NUL terminated. */ -int find_ident_under_cursor(string, find_type) -char_u **string; -int find_type; +int find_ident_under_cursor(char_u **string, int find_type) { return find_ident_at_pos(curwin, curwin->w_cursor.lnum, curwin->w_cursor.col, string, find_type); @@ -2751,12 +2773,7 @@ int find_type; * Like find_ident_under_cursor(), but for any window and any position. * However: Uses 'iskeyword' from the current window!. */ -int find_ident_at_pos(wp, lnum, startcol, string, find_type) -win_T *wp; -linenr_T lnum; -colnr_T startcol; -char_u **string; -int find_type; +int find_ident_at_pos(win_T *wp, linenr_T lnum, colnr_T startcol, char_u **string, int find_type) { char_u *ptr; int col = 0; /* init to shut up GCC */ @@ -2870,8 +2887,7 @@ int find_type; /* * Prepare for redo of a normal command. */ -static void prep_redo_cmd(cap) -cmdarg_T *cap; +static void prep_redo_cmd(cmdarg_T *cap) { prep_redo(cap->oap->regname, cap->count0, NUL, cap->cmdchar, NUL, NUL, cap->nchar); @@ -2881,14 +2897,7 @@ cmdarg_T *cap; * Prepare for redo of any command. * Note that only the last argument can be a multi-byte char. */ -static void prep_redo(regname, num, cmd1, cmd2, cmd3, cmd4, cmd5) -int regname; -long num; -int cmd1; -int cmd2; -int cmd3; -int cmd4; -int cmd5; +static void prep_redo(int regname, long num, int cmd1, int cmd2, int cmd3, int cmd4, int cmd5) { ResetRedobuff(); if (regname != 0) { /* yank from specified buffer */ @@ -2915,8 +2924,7 @@ int cmd5; * * return TRUE if operator was active */ -static int checkclearop(oap) -oparg_T *oap; +static int checkclearop(oparg_T *oap) { if (oap->op_type == OP_NOP) return FALSE; @@ -2929,8 +2937,7 @@ oparg_T *oap; * * Return TRUE if operator or Visual was active. */ -static int checkclearopq(oap) -oparg_T *oap; +static int checkclearopq(oparg_T *oap) { if (oap->op_type == OP_NOP && !VIsual_active @@ -2940,8 +2947,7 @@ oparg_T *oap; return TRUE; } -static void clearop(oap) -oparg_T *oap; +static void clearop(oparg_T *oap) { oap->op_type = OP_NOP; oap->regname = 0; @@ -2949,8 +2955,7 @@ oparg_T *oap; oap->use_reg_one = FALSE; } -static void clearopbeep(oap) -oparg_T *oap; +static void clearopbeep(oparg_T *oap) { clearop(oap); beep_flush(); @@ -2959,8 +2964,7 @@ oparg_T *oap; /* * Remove the shift modifier from a special key. */ -static void unshift_special(cap) -cmdarg_T *cap; +static void unshift_special(cmdarg_T *cap) { switch (cap->cmdchar) { case K_S_RIGHT: cap->cmdchar = K_RIGHT; break; @@ -2985,7 +2989,7 @@ static int showcmd_visual = FALSE; static void display_showcmd __ARGS((void)); -void clear_showcmd() { +void clear_showcmd(void) { if (!p_sc) return; @@ -3066,8 +3070,7 @@ void clear_showcmd() { * Add 'c' to string of shown command chars. * Return TRUE if output has been written (and setcursor() has been called). */ -int add_to_showcmd(c) -int c; +int add_to_showcmd(int c) { char_u *p; int old_len; @@ -3119,8 +3122,7 @@ int c; return TRUE; } -void add_to_showcmd_c(c) -int c; +void add_to_showcmd_c(int c) { if (!add_to_showcmd(c)) setcursor(); @@ -3129,8 +3131,7 @@ int c; /* * Delete 'len' characters from the end of the shown command. */ -static void del_from_showcmd(len) -int len; +static void del_from_showcmd(int len) { int old_len; @@ -3150,12 +3151,12 @@ int len; * push_showcmd() and pop_showcmd() are used when waiting for the user to type * something and there is a partial mapping. */ -void push_showcmd() { +void push_showcmd(void) { if (p_sc) STRCPY(old_showcmd_buf, showcmd_buf); } -void pop_showcmd() { +void pop_showcmd(void) { if (!p_sc) return; @@ -3164,7 +3165,7 @@ void pop_showcmd() { display_showcmd(); } -static void display_showcmd() { +static void display_showcmd(void) { int len; cursor_off(); @@ -3191,8 +3192,7 @@ static void display_showcmd() { * When "check" is TRUE, take care of scroll-binding after the window has * scrolled. Called from normal_cmd() and edit(). */ -void do_check_scrollbind(check) -int check; +void do_check_scrollbind(int check) { static win_T *old_curwin = NULL; static linenr_T old_topline = 0; @@ -3248,9 +3248,7 @@ int check; * number of rows by which the current window has changed * (1998-11-02 16:21:01 R. Edward Ralston <eralston@computer.org>) */ -void check_scrollbind(topline_diff, leftcol_diff) -linenr_T topline_diff; -long leftcol_diff; +void check_scrollbind(linenr_T topline_diff, long leftcol_diff) { int want_ver; int want_hor; @@ -3327,8 +3325,7 @@ long leftcol_diff; * Used for CTRL-Q and CTRL-S to avoid problems with terminals that use * xon/xoff. */ -static void nv_ignore(cap) -cmdarg_T *cap; +static void nv_ignore(cmdarg_T *cap) { cap->retval |= CA_COMMAND_BUSY; /* don't call edit() now */ } @@ -3337,16 +3334,14 @@ cmdarg_T *cap; * Command character that doesn't do anything, but unlike nv_ignore() does * start edit(). Used for "startinsert" executed while starting up. */ -static void nv_nop(cap) -cmdarg_T *cap UNUSED; +static void nv_nop(cmdarg_T *cap) { } /* * Command character doesn't exist. */ -static void nv_error(cap) -cmdarg_T *cap; +static void nv_error(cmdarg_T *cap) { clearopbeep(cap->oap); } @@ -3354,8 +3349,7 @@ cmdarg_T *cap; /* * <Help> and <F1> commands. */ -static void nv_help(cap) -cmdarg_T *cap; +static void nv_help(cmdarg_T *cap) { if (!checkclearopq(cap->oap)) ex_help(NULL); @@ -3364,8 +3358,7 @@ cmdarg_T *cap; /* * CTRL-A and CTRL-X: Add or subtract from letter or number under cursor. */ -static void nv_addsub(cap) -cmdarg_T *cap; +static void nv_addsub(cmdarg_T *cap) { if (!checkclearopq(cap->oap) && do_addsub((int)cap->cmdchar, cap->count1) == OK) @@ -3375,8 +3368,7 @@ cmdarg_T *cap; /* * CTRL-F, CTRL-B, etc: Scroll page up or down. */ -static void nv_page(cap) -cmdarg_T *cap; +static void nv_page(cmdarg_T *cap) { if (!checkclearop(cap->oap)) { if (mod_mask & MOD_MASK_CTRL) { @@ -3393,10 +3385,12 @@ cmdarg_T *cap; /* * Implementation of "gd" and "gD" command. */ -static void nv_gd(oap, nchar, thisblock) -oparg_T *oap; -int nchar; -int thisblock; /* 1 for "1gd" and "1gD" */ +static void +nv_gd ( + oparg_T *oap, + int nchar, + int thisblock /* 1 for "1gd" and "1gD" */ +) { int len; char_u *ptr; @@ -3415,12 +3409,14 @@ int thisblock; /* 1 for "1gd" and "1gD" */ * When "thisblock" is TRUE check the {} block scope. * Return FAIL when not found. */ -int find_decl(ptr, len, locally, thisblock, searchflags) -char_u *ptr; -int len; -int locally; -int thisblock; -int searchflags; /* flags passed to searchit() */ +int +find_decl ( + char_u *ptr, + int len, + int locally, + int thisblock, + int searchflags /* flags passed to searchit() */ +) { char_u *pat; pos_T old_pos; @@ -3532,10 +3528,7 @@ int searchflags; /* flags passed to searchit() */ * * Return OK if able to move cursor, FAIL otherwise. */ -static int nv_screengo(oap, dir, dist) -oparg_T *oap; -int dir; -long dist; +static int nv_screengo(oparg_T *oap, int dir, long dist) { int linelen = linetabsize(ml_get_curline()); int retval = OK; @@ -3660,8 +3653,7 @@ long dist; * K_MOUSEUP (cap->arg == 1) or K_MOUSEDOWN (cap->arg == 0) or * K_MOUSELEFT (cap->arg == -1) or K_MOUSERIGHT (cap->arg == -2) */ -static void nv_mousescroll(cap) -cmdarg_T *cap; +static void nv_mousescroll(cmdarg_T *cap) { win_T *old_curwin = curwin; @@ -3695,8 +3687,7 @@ cmdarg_T *cap; /* * Mouse clicks and drags. */ -static void nv_mouse(cap) -cmdarg_T *cap; +static void nv_mouse(cmdarg_T *cap) { (void)do_mouse(cap->oap, cap->cmdchar, BACKWARD, cap->count1, 0); } @@ -3705,8 +3696,7 @@ cmdarg_T *cap; * Handle CTRL-E and CTRL-Y commands: scroll a line up or down. * cap->arg must be TRUE for CTRL-E. */ -static void nv_scroll_line(cap) -cmdarg_T *cap; +static void nv_scroll_line(cmdarg_T *cap) { if (!checkclearop(cap->oap)) scroll_redraw(cap->arg, cap->count1); @@ -3715,9 +3705,7 @@ cmdarg_T *cap; /* * Scroll "count" lines up or down, and redraw. */ -void scroll_redraw(up, count) -int up; -long count; +void scroll_redraw(int up, long count) { linenr_T prev_topline = curwin->w_topline; int prev_topfill = curwin->w_topfill; @@ -3764,8 +3752,7 @@ long count; /* * Commands that start with "z". */ -static void nv_zet(cap) -cmdarg_T *cap; +static void nv_zet(cmdarg_T *cap) { long n; colnr_T col; @@ -4191,8 +4178,7 @@ dozet: /* * "Q" command. */ -static void nv_exmode(cap) -cmdarg_T *cap; +static void nv_exmode(cmdarg_T *cap) { /* * Ignore 'Q' in Visual mode, just give a beep. @@ -4206,8 +4192,7 @@ cmdarg_T *cap; /* * Handle a ":" command. */ -static void nv_colon(cap) -cmdarg_T *cap; +static void nv_colon(cmdarg_T *cap) { int old_p_im; int cmd_result; @@ -4264,8 +4249,7 @@ cmdarg_T *cap; /* * Handle CTRL-G command. */ -static void nv_ctrlg(cap) -cmdarg_T *cap; +static void nv_ctrlg(cmdarg_T *cap) { if (VIsual_active) { /* toggle Selection/Visual mode */ VIsual_select = !VIsual_select; @@ -4278,8 +4262,7 @@ cmdarg_T *cap; /* * Handle CTRL-H <Backspace> command. */ -static void nv_ctrlh(cap) -cmdarg_T *cap; +static void nv_ctrlh(cmdarg_T *cap) { if (VIsual_active && VIsual_select) { cap->cmdchar = 'x'; /* BS key behaves like 'x' in Select mode */ @@ -4291,8 +4274,7 @@ cmdarg_T *cap; /* * CTRL-L: clear screen and redraw. */ -static void nv_clear(cap) -cmdarg_T *cap; +static void nv_clear(cmdarg_T *cap) { if (!checkclearop(cap->oap)) { /* Clear all syntax states to force resyncing. */ @@ -4305,8 +4287,7 @@ cmdarg_T *cap; * CTRL-O: In Select mode: switch to Visual mode for one command. * Otherwise: Go to older pcmark. */ -static void nv_ctrlo(cap) -cmdarg_T *cap; +static void nv_ctrlo(cmdarg_T *cap) { if (VIsual_active && VIsual_select) { VIsual_select = FALSE; @@ -4321,8 +4302,7 @@ cmdarg_T *cap; /* * CTRL-^ command, short for ":e #" */ -static void nv_hat(cap) -cmdarg_T *cap; +static void nv_hat(cmdarg_T *cap) { if (!checkclearopq(cap->oap)) (void)buflist_getfile((int)cap->count0, (linenr_T)0, @@ -4332,8 +4312,7 @@ cmdarg_T *cap; /* * "Z" commands. */ -static void nv_Zet(cap) -cmdarg_T *cap; +static void nv_Zet(cmdarg_T *cap) { if (!checkclearopq(cap->oap)) { switch (cap->nchar) { @@ -4353,9 +4332,7 @@ cmdarg_T *cap; /* * Call nv_ident() as if "c1" was used, with "c2" as next character. */ -void do_nv_ident(c1, c2) -int c1; -int c2; +void do_nv_ident(int c1, int c2) { oparg_T oa; cmdarg_T ca; @@ -4376,8 +4353,7 @@ int c2; * [g] '#' ? to current identifier or string * g ']' :tselect for current identifier */ -static void nv_ident(cap) -cmdarg_T *cap; +static void nv_ident(cmdarg_T *cap) { char_u *ptr = NULL; char_u *buf; @@ -4581,10 +4557,12 @@ cmdarg_T *cap; * Get visually selected text, within one line only. * Returns FAIL if more than one line selected. */ -int get_visual_text(cap, pp, lenp) -cmdarg_T *cap; -char_u **pp; /* return: start of selected text */ -int *lenp; /* return: length of selected text */ +int +get_visual_text ( + cmdarg_T *cap, + char_u **pp, /* return: start of selected text */ + int *lenp /* return: length of selected text */ +) { if (VIsual_mode != 'V') unadjust_for_sel(); @@ -4615,8 +4593,7 @@ int *lenp; /* return: length of selected text */ /* * CTRL-T: backwards in tag stack */ -static void nv_tagpop(cap) -cmdarg_T *cap; +static void nv_tagpop(cmdarg_T *cap) { if (!checkclearopq(cap->oap)) do_tag((char_u *)"", DT_POP, (int)cap->count1, FALSE, TRUE); @@ -4625,8 +4602,7 @@ cmdarg_T *cap; /* * Handle scrolling command 'H', 'L' and 'M'. */ -static void nv_scroll(cap) -cmdarg_T *cap; +static void nv_scroll(cmdarg_T *cap) { int used = 0; long n; @@ -4700,8 +4676,7 @@ cmdarg_T *cap; /* * Cursor right commands. */ -static void nv_right(cap) -cmdarg_T *cap; +static void nv_right(cmdarg_T *cap) { long n; int PAST_LINE; @@ -4789,8 +4764,7 @@ cmdarg_T *cap; * * Returns TRUE when operator end should not be adjusted. */ -static void nv_left(cap) -cmdarg_T *cap; +static void nv_left(cmdarg_T *cap) { long n; @@ -4850,8 +4824,7 @@ cmdarg_T *cap; * Cursor up commands. * cap->arg is TRUE for "-": Move cursor to first non-blank. */ -static void nv_up(cap) -cmdarg_T *cap; +static void nv_up(cmdarg_T *cap) { if (mod_mask & MOD_MASK_SHIFT) { /* <S-Up> is page up */ @@ -4870,8 +4843,7 @@ cmdarg_T *cap; * Cursor down commands. * cap->arg is TRUE for CR and "+": Move cursor to first non-blank. */ -static void nv_down(cap) -cmdarg_T *cap; +static void nv_down(cmdarg_T *cap) { if (mod_mask & MOD_MASK_SHIFT) { /* <S-Down> is page down */ @@ -4901,8 +4873,7 @@ cmdarg_T *cap; /* * Grab the file name under the cursor and edit it. */ -static void nv_gotofile(cap) -cmdarg_T *cap; +static void nv_gotofile(cmdarg_T *cap) { char_u *ptr; linenr_T lnum = -1; @@ -4939,8 +4910,7 @@ cmdarg_T *cap; /* * <End> command: to end of current line or last line. */ -static void nv_end(cap) -cmdarg_T *cap; +static void nv_end(cmdarg_T *cap) { if (cap->arg || (mod_mask & MOD_MASK_CTRL)) { /* CTRL-END = goto last line */ cap->arg = TRUE; @@ -4953,8 +4923,7 @@ cmdarg_T *cap; /* * Handle the "$" command. */ -static void nv_dollar(cap) -cmdarg_T *cap; +static void nv_dollar(cmdarg_T *cap) { cap->oap->motion_type = MCHAR; cap->oap->inclusive = TRUE; @@ -4975,8 +4944,7 @@ cmdarg_T *cap; * Implementation of '?' and '/' commands. * If cap->arg is TRUE don't set PC mark. */ -static void nv_search(cap) -cmdarg_T *cap; +static void nv_search(cmdarg_T *cap) { oparg_T *oap = cap->oap; @@ -5003,8 +4971,7 @@ cmdarg_T *cap; * Handle "N" and "n" commands. * cap->arg is SEARCH_REV for "N", 0 for "n". */ -static void nv_next(cap) -cmdarg_T *cap; +static void nv_next(cmdarg_T *cap) { normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg); } @@ -5013,11 +4980,13 @@ cmdarg_T *cap; * Search for "pat" in direction "dir" ('/' or '?', 0 for repeat). * Uses only cap->count1 and cap->oap from "cap". */ -static void normal_search(cap, dir, pat, opt) -cmdarg_T *cap; -int dir; -char_u *pat; -int opt; /* extra flags for do_search() */ +static void +normal_search ( + cmdarg_T *cap, + int dir, + char_u *pat, + int opt /* extra flags for do_search() */ +) { int i; @@ -5049,8 +5018,7 @@ int opt; /* extra flags for do_search() */ * ',' and FALSE for ';'. * cap->nchar is NUL for ',' and ';' (repeat the search) */ -static void nv_csearch(cap) -cmdarg_T *cap; +static void nv_csearch(cmdarg_T *cap) { int t_cmd; @@ -5083,8 +5051,7 @@ cmdarg_T *cap; * "[" and "]" commands. * cap->arg is BACKWARD for "[" and FORWARD for "]". */ -static void nv_brackets(cap) -cmdarg_T *cap; +static void nv_brackets(cmdarg_T *cap) { pos_T new_pos = INIT_POS_T(0, 0, 0); pos_T prev_pos; @@ -5342,8 +5309,7 @@ cmdarg_T *cap; /* * Handle Normal mode "%" command. */ -static void nv_percent(cap) -cmdarg_T *cap; +static void nv_percent(cmdarg_T *cap) { pos_T *pos; linenr_T lnum = curwin->w_cursor.lnum; @@ -5391,8 +5357,7 @@ cmdarg_T *cap; * Handle "(" and ")" commands. * cap->arg is BACKWARD for "(" and FORWARD for ")". */ -static void nv_brace(cap) -cmdarg_T *cap; +static void nv_brace(cmdarg_T *cap) { cap->oap->motion_type = MCHAR; cap->oap->use_reg_one = TRUE; @@ -5414,8 +5379,7 @@ cmdarg_T *cap; /* * "m" command: Mark a position. */ -static void nv_mark(cap) -cmdarg_T *cap; +static void nv_mark(cmdarg_T *cap) { if (!checkclearop(cap->oap)) { if (setmark(cap->nchar) == FAIL) @@ -5427,8 +5391,7 @@ cmdarg_T *cap; * "{" and "}" commands. * cmd->arg is BACKWARD for "{" and FORWARD for "}". */ -static void nv_findpar(cap) -cmdarg_T *cap; +static void nv_findpar(cmdarg_T *cap) { cap->oap->motion_type = MCHAR; cap->oap->inclusive = FALSE; @@ -5446,8 +5409,7 @@ cmdarg_T *cap; /* * "u" command: Undo or make lower case. */ -static void nv_undo(cap) -cmdarg_T *cap; +static void nv_undo(cmdarg_T *cap) { if (cap->oap->op_type == OP_LOWER || VIsual_active @@ -5463,8 +5425,7 @@ cmdarg_T *cap; /* * <Undo> command. */ -static void nv_kundo(cap) -cmdarg_T *cap; +static void nv_kundo(cmdarg_T *cap) { if (!checkclearopq(cap->oap)) { u_undo((int)cap->count1); @@ -5475,8 +5436,7 @@ cmdarg_T *cap; /* * Handle the "r" command. */ -static void nv_replace(cap) -cmdarg_T *cap; +static void nv_replace(cmdarg_T *cap) { char_u *ptr; int had_ctrl_v; @@ -5646,8 +5606,7 @@ cmdarg_T *cap; * 'o': Exchange start and end of Visual area. * 'O': same, but in block mode exchange left and right corners. */ -static void v_swap_corners(cmdchar) -int cmdchar; +static void v_swap_corners(int cmdchar) { pos_T old_cursor; colnr_T left, right; @@ -5691,8 +5650,7 @@ int cmdchar; /* * "R" (cap->arg is FALSE) and "gR" (cap->arg is TRUE). */ -static void nv_Replace(cap) -cmdarg_T *cap; +static void nv_Replace(cmdarg_T *cap) { if (VIsual_active) { /* "R" is replace lines */ cap->cmdchar = 'c'; @@ -5714,8 +5672,7 @@ cmdarg_T *cap; /* * "gr". */ -static void nv_vreplace(cap) -cmdarg_T *cap; +static void nv_vreplace(cmdarg_T *cap) { if (VIsual_active) { cap->cmdchar = 'r'; @@ -5739,8 +5696,7 @@ cmdarg_T *cap; /* * Swap case for "~" command, when it does not work like an operator. */ -static void n_swapchar(cap) -cmdarg_T *cap; +static void n_swapchar(cmdarg_T *cap) { long n; pos_T startpos; @@ -5794,10 +5750,7 @@ cmdarg_T *cap; /* * Move cursor to mark. */ -static void nv_cursormark(cap, flag, pos) -cmdarg_T *cap; -int flag; -pos_T *pos; +static void nv_cursormark(cmdarg_T *cap, int flag, pos_T *pos) { if (check_mark(pos) == FAIL) clearop(cap->oap); @@ -5823,8 +5776,7 @@ pos_T *pos; /* * Handle commands that are operators in Visual mode. */ -static void v_visop(cap) -cmdarg_T *cap; +static void v_visop(cmdarg_T *cap) { static char_u trans[] = "YyDdCcxdXdAAIIrr"; @@ -5844,8 +5796,7 @@ cmdarg_T *cap; /* * "s" and "S" commands. */ -static void nv_subst(cap) -cmdarg_T *cap; +static void nv_subst(cmdarg_T *cap) { if (VIsual_active) { /* "vs" and "vS" are the same as "vc" */ if (cap->cmdchar == 'S') { @@ -5861,8 +5812,7 @@ cmdarg_T *cap; /* * Abbreviated commands. */ -static void nv_abbrev(cap) -cmdarg_T *cap; +static void nv_abbrev(cmdarg_T *cap) { if (cap->cmdchar == K_DEL || cap->cmdchar == K_KDEL) cap->cmdchar = 'x'; /* DEL key behaves like 'x' */ @@ -5877,8 +5827,7 @@ cmdarg_T *cap; /* * Translate a command into another command. */ -static void nv_optrans(cap) -cmdarg_T *cap; +static void nv_optrans(cmdarg_T *cap) { static char_u *(ar[8]) = {(char_u *)"dl", (char_u *)"dh", (char_u *)"d$", (char_u *)"c$", @@ -5911,8 +5860,7 @@ cmdarg_T *cap; * "'" and "`" commands. Also for "g'" and "g`". * cap->arg is TRUE for "'" and "g'". */ -static void nv_gomark(cap) -cmdarg_T *cap; +static void nv_gomark(cmdarg_T *cap) { pos_T *pos; int c; @@ -5947,8 +5895,7 @@ cmdarg_T *cap; /* * Handle CTRL-O, CTRL-I, "g;" and "g," commands. */ -static void nv_pcmark(cap) -cmdarg_T *cap; +static void nv_pcmark(cmdarg_T *cap) { pos_T *pos; linenr_T lnum = curwin->w_cursor.lnum; @@ -5984,8 +5931,7 @@ cmdarg_T *cap; /* * Handle '"' command. */ -static void nv_regname(cap) -cmdarg_T *cap; +static void nv_regname(cmdarg_T *cap) { if (checkclearop(cap->oap)) return; @@ -6005,8 +5951,7 @@ cmdarg_T *cap; * is TRUE. * Handle CTRL-Q just like CTRL-V. */ -static void nv_visual(cap) -cmdarg_T *cap; +static void nv_visual(cmdarg_T *cap) { if (cap->cmdchar == Ctrl_Q) cap->cmdchar = Ctrl_V; @@ -6095,7 +6040,7 @@ cmdarg_T *cap; /* * Start selection for Shift-movement keys. */ -void start_selection() { +void start_selection(void) { /* if 'selectmode' contains "key", start Select mode */ may_start_select('k'); n_start_visual_mode('v'); @@ -6104,8 +6049,7 @@ void start_selection() { /* * Start Select mode, if "c" is in 'selectmode' and not in a mapping or menu. */ -void may_start_select(c) -int c; +void may_start_select(int c) { VIsual_select = (stuff_empty() && typebuf_typed() && (vim_strchr(p_slm, c) != NULL)); @@ -6115,8 +6059,7 @@ int c; * Start Visual mode "c". * Should set VIsual_select before calling this. */ -static void n_start_visual_mode(c) -int c; +static void n_start_visual_mode(int c) { /* Check for redraw before changing the state. */ conceal_check_cursur_line(); @@ -6154,8 +6097,7 @@ int c; /* * CTRL-W: Window commands */ -static void nv_window(cap) -cmdarg_T *cap; +static void nv_window(cmdarg_T *cap) { if (!checkclearop(cap->oap)) do_window(cap->nchar, cap->count0, NUL); /* everything is in window.c */ @@ -6164,8 +6106,7 @@ cmdarg_T *cap; /* * CTRL-Z: Suspend */ -static void nv_suspend(cap) -cmdarg_T *cap; +static void nv_suspend(cmdarg_T *cap) { clearop(cap->oap); if (VIsual_active) @@ -6176,8 +6117,7 @@ cmdarg_T *cap; /* * Commands starting with "g". */ -static void nv_g_cmd(cap) -cmdarg_T *cap; +static void nv_g_cmd(cmdarg_T *cap) { oparg_T *oap = cap->oap; pos_T tpos; @@ -6692,8 +6632,7 @@ cmdarg_T *cap; /* * Handle "o" and "O" commands. */ -static void n_opencmd(cap) -cmdarg_T *cap; +static void n_opencmd(cmdarg_T *cap) { linenr_T oldline = curwin->w_cursor.lnum; @@ -6727,8 +6666,7 @@ cmdarg_T *cap; /* * "." command: redo last change. */ -static void nv_dot(cap) -cmdarg_T *cap; +static void nv_dot(cmdarg_T *cap) { if (!checkclearopq(cap->oap)) { /* @@ -6744,8 +6682,7 @@ cmdarg_T *cap; /* * CTRL-R: undo undo */ -static void nv_redo(cap) -cmdarg_T *cap; +static void nv_redo(cmdarg_T *cap) { if (!checkclearopq(cap->oap)) { u_redo((int)cap->count1); @@ -6756,8 +6693,7 @@ cmdarg_T *cap; /* * Handle "U" command. */ -static void nv_Undo(cap) -cmdarg_T *cap; +static void nv_Undo(cmdarg_T *cap) { /* In Visual mode and typing "gUU" triggers an operator */ if (cap->oap->op_type == OP_UPPER @@ -6777,8 +6713,7 @@ cmdarg_T *cap; * '~' command: If tilde is not an operator and Visual is off: swap case of a * single character. */ -static void nv_tilde(cap) -cmdarg_T *cap; +static void nv_tilde(cmdarg_T *cap) { if (!p_to && !VIsual_active @@ -6792,8 +6727,7 @@ cmdarg_T *cap; * Handle an operator command. * The actual work is done by do_pending_operator(). */ -static void nv_operator(cap) -cmdarg_T *cap; +static void nv_operator(cmdarg_T *cap) { int op_type; @@ -6811,8 +6745,7 @@ cmdarg_T *cap; /* * Set v:operator to the characters for "optype". */ -static void set_op_var(optype) -int optype; +static void set_op_var(int optype) { char_u opchars[3]; @@ -6835,8 +6768,7 @@ int optype; * are really an alternate form of "d_" and "y_". It does accept a count, so * "d3_" works to delete 3 lines. */ -static void nv_lineop(cap) -cmdarg_T *cap; +static void nv_lineop(cmdarg_T *cap) { cap->oap->motion_type = MLINE; if (cursor_down(cap->count1 - 1L, cap->oap->op_type == OP_NOP) == FAIL) @@ -6854,8 +6786,7 @@ cmdarg_T *cap; /* * <Home> command. */ -static void nv_home(cap) -cmdarg_T *cap; +static void nv_home(cmdarg_T *cap) { /* CTRL-HOME is like "gg" */ if (mod_mask & MOD_MASK_CTRL) @@ -6871,8 +6802,7 @@ cmdarg_T *cap; /* * "|" command. */ -static void nv_pipe(cap) -cmdarg_T *cap; +static void nv_pipe(cmdarg_T *cap) { cap->oap->motion_type = MCHAR; cap->oap->inclusive = FALSE; @@ -6891,8 +6821,7 @@ cmdarg_T *cap; * Handle back-word command "b" and "B". * cap->arg is 1 for "B" */ -static void nv_bck_word(cap) -cmdarg_T *cap; +static void nv_bck_word(cmdarg_T *cap) { cap->oap->motion_type = MCHAR; cap->oap->inclusive = FALSE; @@ -6907,8 +6836,7 @@ cmdarg_T *cap; * Handle word motion commands "e", "E", "w" and "W". * cap->arg is TRUE for "E" and "W". */ -static void nv_wordcmd(cap) -cmdarg_T *cap; +static void nv_wordcmd(cmdarg_T *cap) { int n; int word_end; @@ -6987,8 +6915,7 @@ cmdarg_T *cap; * end of the line, may move it back to the last character and make the motion * inclusive. */ -static void adjust_cursor(oap) -oparg_T *oap; +static void adjust_cursor(oparg_T *oap) { /* The cursor cannot remain on the NUL when: * - the column is > 0 @@ -7011,8 +6938,7 @@ oparg_T *oap; * "0" and "^" commands. * cap->arg is the argument for beginline(). */ -static void nv_beginline(cap) -cmdarg_T *cap; +static void nv_beginline(cmdarg_T *cap) { cap->oap->motion_type = MCHAR; cap->oap->inclusive = FALSE; @@ -7026,8 +6952,7 @@ cmdarg_T *cap; /* * In exclusive Visual mode, may include the last character. */ -static void adjust_for_sel(cap) -cmdarg_T *cap; +static void adjust_for_sel(cmdarg_T *cap) { if (VIsual_active && cap->oap->inclusive && *p_sel == 'e' && gchar_cursor() != NUL && lt(VIsual, curwin->w_cursor)) { @@ -7044,7 +6969,7 @@ cmdarg_T *cap; * Should check VIsual_mode before calling this. * Returns TRUE when backed up to the previous line. */ -static int unadjust_for_sel() { +static int unadjust_for_sel(void) { pos_T *pp; if (*p_sel == 'e' && !equalpos(VIsual, curwin->w_cursor)) { @@ -7069,8 +6994,7 @@ static int unadjust_for_sel() { /* * SELECT key in Normal or Visual mode: end of Select mode mapping. */ -static void nv_select(cap) -cmdarg_T *cap; +static void nv_select(cmdarg_T *cap) { if (VIsual_active) VIsual_select = TRUE; @@ -7086,8 +7010,7 @@ cmdarg_T *cap; * "G", "gg", CTRL-END, CTRL-HOME. * cap->arg is TRUE for "G". */ -static void nv_goto(cap) -cmdarg_T *cap; +static void nv_goto(cmdarg_T *cap) { linenr_T lnum; @@ -7114,8 +7037,7 @@ cmdarg_T *cap; /* * CTRL-\ in Normal mode. */ -static void nv_normal(cap) -cmdarg_T *cap; +static void nv_normal(cmdarg_T *cap) { if (cap->nchar == Ctrl_N || cap->nchar == Ctrl_G) { clearop(cap->oap); @@ -7139,8 +7061,7 @@ cmdarg_T *cap; * ESC in Normal mode: beep, but don't flush buffers. * Don't even beep if we are canceling a command. */ -static void nv_esc(cap) -cmdarg_T *cap; +static void nv_esc(cmdarg_T *cap) { int no_reason; @@ -7188,8 +7109,7 @@ cmdarg_T *cap; /* * Handle "A", "a", "I", "i" and <Insert> commands. */ -static void nv_edit(cap) -cmdarg_T *cap; +static void nv_edit(cmdarg_T *cap) { /* <Insert> is equal to "i" */ if (cap->cmdchar == K_INS || cap->cmdchar == K_KINS) @@ -7262,11 +7182,13 @@ cmdarg_T *cap; /* * Invoke edit() and take care of "restart_edit" and the return value. */ -static void invoke_edit(cap, repl, cmd, startln) -cmdarg_T *cap; -int repl; /* "r" or "gr" command */ -int cmd; -int startln; +static void +invoke_edit ( + cmdarg_T *cap, + int repl, /* "r" or "gr" command */ + int cmd, + int startln +) { int restart_edit_save = 0; @@ -7291,8 +7213,7 @@ int startln; /* * "a" or "i" while an operator is pending or in Visual mode: object motion. */ -static void nv_object(cap) -cmdarg_T *cap; +static void nv_object(cmdarg_T *cap) { int flag; int include; @@ -7363,8 +7284,7 @@ cmdarg_T *cap; * "q" command: Start/stop recording. * "q:", "q/", "q?": edit command-line in command-line window. */ -static void nv_record(cap) -cmdarg_T *cap; +static void nv_record(cmdarg_T *cap) { if (cap->oap->op_type == OP_FORMAT) { /* "gqq" is the same as "gqgq": format line */ @@ -7386,8 +7306,7 @@ cmdarg_T *cap; /* * Handle the "@r" command. */ -static void nv_at(cap) -cmdarg_T *cap; +static void nv_at(cmdarg_T *cap) { if (checkclearop(cap->oap)) return; @@ -7407,8 +7326,7 @@ cmdarg_T *cap; /* * Handle the CTRL-U and CTRL-D commands. */ -static void nv_halfpage(cap) -cmdarg_T *cap; +static void nv_halfpage(cmdarg_T *cap) { if ((cap->cmdchar == Ctrl_U && curwin->w_cursor.lnum == 1) || (cap->cmdchar == Ctrl_D @@ -7421,8 +7339,7 @@ cmdarg_T *cap; /* * Handle "J" or "gJ" command. */ -static void nv_join(cap) -cmdarg_T *cap; +static void nv_join(cmdarg_T *cap) { if (VIsual_active) /* join the visual lines */ nv_operator(cap); @@ -7443,8 +7360,7 @@ cmdarg_T *cap; /* * "P", "gP", "p" and "gp" commands. */ -static void nv_put(cap) -cmdarg_T *cap; +static void nv_put(cmdarg_T *cap) { int regname = 0; void *reg1 = NULL, *reg2 = NULL; @@ -7555,8 +7471,7 @@ cmdarg_T *cap; /* * "o" and "O" commands. */ -static void nv_open(cap) -cmdarg_T *cap; +static void nv_open(cmdarg_T *cap) { /* "do" is ":diffget" */ if (cap->oap->op_type == OP_DELETE && cap->cmdchar == 'o') { @@ -7576,8 +7491,7 @@ cmdarg_T *cap; * When waiting for a character for 'updatetime' K_CURSORHOLD is put in the * input buffer. "did_cursorhold" is set to avoid retriggering. */ -static void nv_cursorhold(cap) -cmdarg_T *cap; +static void nv_cursorhold(cmdarg_T *cap) { apply_autocmds(EVENT_CURSORHOLD, NULL, NULL, FALSE, curbuf); did_cursorhold = TRUE; |