diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-05-09 20:09:23 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-05-09 20:09:23 +0100 |
commit | 6ed545e79735f23ff8e650bc2f0967e5a0baedc9 (patch) | |
tree | 1c77e4b188c34d68e91c5c93e62c668ce51ffc2f | |
parent | 921bde88804663a7cb825d7f7e8a5d8ae6b58650 (diff) |
patch 8.2.4928: various white space and cosmetic mistakesv8.2.4928
Problem: Various white space and cosmetic mistakes.
Solution: Change spaces to tabs, improve comments.
49 files changed, 166 insertions, 161 deletions
diff --git a/src/bufwrite.c b/src/bufwrite.c index 7cf572424e..8db4266265 100644 --- a/src/bufwrite.c +++ b/src/bufwrite.c @@ -30,7 +30,7 @@ struct bw_info int bw_flags; // FIO_ flags #ifdef FEAT_CRYPT buf_T *bw_buffer; // buffer being written - int bw_finish; // finish encrypting + int bw_finish; // finish encrypting #endif char_u bw_rest[CONV_RESTLEN]; // not converted bytes int bw_restlen; // nr of bytes in bw_rest[] @@ -39,7 +39,7 @@ struct bw_info size_t bw_conv_buflen; // size of bw_conv_buf int bw_conv_error; // set for conversion error linenr_T bw_conv_error_lnum; // first line with error or zero - linenr_T bw_start_lnum; // line number at start of buffer + linenr_T bw_start_lnum; // line number at start of buffer #ifdef USE_ICONV iconv_t bw_iconv_fd; // descriptor for iconv() or -1 #endif diff --git a/src/channel.c b/src/channel.c index 52dfaafb3e..e3b32eebf8 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1996,7 +1996,7 @@ channel_get_all(channel_T *channel, ch_part_T part, int *outlen) && p[3] == ';') { // '\a' becomes a NL - while (p < res + (len - 1) && *p != '\a') + while (p < res + (len - 1) && *p != '\a') ++p; // BEL is zero width characters, suppress display mistake // ConPTY (after 10.0.18317) requires advance checking diff --git a/src/cindent.c b/src/cindent.c index dc9c20320f..ec88036eb1 100644 --- a/src/cindent.c +++ b/src/cindent.c @@ -2181,8 +2181,8 @@ get_c_indent(void) check_linecomment(ml_get(curwin->w_cursor.lnum - 1)); if (linecomment_pos.col != MAXCOL) { - trypos = &linecomment_pos; - trypos->lnum = curwin->w_cursor.lnum - 1; + trypos = &linecomment_pos; + trypos->lnum = curwin->w_cursor.lnum - 1; } } if (trypos != NULL) diff --git a/src/crypt.c b/src/crypt.c index 6a852fa1f9..bed76a96d4 100644 --- a/src/crypt.c +++ b/src/crypt.c @@ -452,8 +452,8 @@ crypt_create( if (cryptmethods[method_nr].init_fn( state, key, salt, salt_len, seed, seed_len) == FAIL) { - vim_free(state); - return NULL; + vim_free(state); + return NULL; } return state; } @@ -692,7 +692,7 @@ crypt_encode_inplace( cryptstate_T *state, char_u *buf, size_t len, - int last) + int last) { cryptmethods[state->method_nr].encode_inplace_fn(state, buf, len, buf, last); diff --git a/src/debugger.c b/src/debugger.c index 87cd398bc8..38d1fb6022 100644 --- a/src/debugger.c +++ b/src/debugger.c @@ -22,7 +22,7 @@ static void do_showbacktrace(char_u *cmd); static char_u *debug_oldval = NULL; // old and newval for debug expressions static char_u *debug_newval = NULL; -static int debug_expr = 0; // use debug_expr +static int debug_expr = 0; // use debug_expr int has_watchexpr(void) diff --git a/src/digraph.c b/src/digraph.c index cfffc192d4..c33fc30251 100644 --- a/src/digraph.c +++ b/src/digraph.c @@ -2337,8 +2337,9 @@ f_digraph_getlist(typval_T *argvars, typval_T *rettv) flag_list_all = FALSE; else { - int error = FALSE; + int error = FALSE; varnumber_T flag = tv_get_number_chk(&argvars[0], &error); + if (error) return; flag_list_all = flag ? TRUE : FALSE; diff --git a/src/edit.c b/src/edit.c index 9457d25c11..3da3db67b7 100644 --- a/src/edit.c +++ b/src/edit.c @@ -3839,8 +3839,7 @@ ins_insert(int replaceState) #ifdef FEAT_EVAL set_vim_var_string(VV_INSERTMODE, (char_u *)((State & REPLACE_FLAG) ? "i" - : replaceState == MODE_VREPLACE ? "v" - : "r"), 1); + : replaceState == MODE_VREPLACE ? "v" : "r"), 1); #endif ins_apply_autocmds(EVENT_INSERTCHANGE); if (State & REPLACE_FLAG) @@ -4895,10 +4894,10 @@ ins_tab(void) // These five lines mean 'tabstop' != 'shiftwidth' && ((tabstop_count(curbuf->b_p_vts_array) > 1) || (tabstop_count(curbuf->b_p_vts_array) == 1 - && tabstop_first(curbuf->b_p_vts_array) + && tabstop_first(curbuf->b_p_vts_array) != get_sw_value(curbuf)) - || (tabstop_count(curbuf->b_p_vts_array) == 0 - && curbuf->b_p_ts != get_sw_value(curbuf)))) + || (tabstop_count(curbuf->b_p_vts_array) == 0 + && curbuf->b_p_ts != get_sw_value(curbuf)))) && tabstop_count(curbuf->b_p_vsts_array) == 0 #else && !(p_sta && ind && curbuf->b_p_ts != get_sw_value(curbuf)) @@ -4924,7 +4923,7 @@ ins_tab(void) temp -= get_nolist_virtcol() % temp; } else if (tabstop_count(curbuf->b_p_vsts_array) > 0 || curbuf->b_p_sts != 0) - // use 'softtabstop' when set + // use 'softtabstop' when set temp = tabstop_padding(get_nolist_virtcol(), get_sts_value(), curbuf->b_p_vsts_array); else // otherwise use 'tabstop' @@ -4963,7 +4962,7 @@ ins_tab(void) */ #ifdef FEAT_VARTABS if (!curbuf->b_p_et && (tabstop_count(curbuf->b_p_vsts_array) > 0 - || get_sts_value() > 0 + || get_sts_value() > 0 || (p_sta && ind))) #else if (!curbuf->b_p_et && (get_sts_value() || (p_sta && ind))) diff --git a/src/evalwindow.c b/src/evalwindow.c index fd62579cd1..20ac66f533 100644 --- a/src/evalwindow.c +++ b/src/evalwindow.c @@ -155,6 +155,8 @@ win_findbuf(typval_T *argvars, list_T *list) /* * Find window specified by "vp" in tabpage "tp". + * Returns current window if "vp" is number zero. + * Returns NULL if not found. */ win_T * find_win_by_nr( @@ -997,28 +999,28 @@ f_win_splitmove(typval_T *argvars, typval_T *rettv) || !win_valid(wp) || !win_valid(targetwin) || win_valid_popup(wp) || win_valid_popup(targetwin)) { - emsg(_(e_invalid_window_number)); + emsg(_(e_invalid_window_number)); rettv->vval.v_number = -1; return; } if (argvars[2].v_type != VAR_UNKNOWN) { - dict_T *d; - dictitem_T *di; - - if (argvars[2].v_type != VAR_DICT || argvars[2].vval.v_dict == NULL) - { - emsg(_(e_invalid_argument)); - return; - } - - d = argvars[2].vval.v_dict; - if (dict_get_bool(d, (char_u *)"vertical", FALSE)) - flags |= WSP_VERT; - if ((di = dict_find(d, (char_u *)"rightbelow", -1)) != NULL) - flags |= tv_get_bool(&di->di_tv) ? WSP_BELOW : WSP_ABOVE; - size = (int)dict_get_number(d, (char_u *)"size"); + dict_T *d; + dictitem_T *di; + + if (argvars[2].v_type != VAR_DICT || argvars[2].vval.v_dict == NULL) + { + emsg(_(e_invalid_argument)); + return; + } + + d = argvars[2].vval.v_dict; + if (dict_get_bool(d, (char_u *)"vertical", FALSE)) + flags |= WSP_VERT; + if ((di = dict_find(d, (char_u *)"rightbelow", -1)) != NULL) + flags |= tv_get_bool(&di->di_tv) ? WSP_BELOW : WSP_ABOVE; + size = (int)dict_get_number(d, (char_u *)"size"); } win_move_into_split(wp, targetwin, size, flags); diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 880bf5a3e4..7e730becb4 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -2511,7 +2511,7 @@ do_ecmd( #endif int readfile_flags = 0; int did_inc_redrawing_disabled = FALSE; - long *so_ptr = curwin->w_p_so >= 0 ? &curwin->w_p_so : &p_so; + long *so_ptr = curwin->w_p_so >= 0 ? &curwin->w_p_so : &p_so; #ifdef FEAT_PROP_POPUP if (ERROR_IF_TERM_POPUP_WINDOW) diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 7633d6bf83..a865f65d19 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -2369,7 +2369,7 @@ do_one_cmd( { ea.line1 = ea.line2; if (ea.line2 >= LONG_MAX - (n - 1)) - ea.line2 = LONG_MAX; // avoid overflow + ea.line2 = LONG_MAX; // avoid overflow else ea.line2 += n - 1; ++ea.addr_count; diff --git a/src/ex_getln.c b/src/ex_getln.c index 14489dec42..cbddfea003 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -110,7 +110,7 @@ empty_pattern_magic(char_u *p, size_t len, magic_T magic_val) { // remove trailing \v and the like while (len >= 2 && p[len - 2] == '\\' - && vim_strchr((char_u *)"mMvVcCZ", p[len - 1]) != NULL) + && vim_strchr((char_u *)"mMvVcCZ", p[len - 1]) != NULL) len -= 2; // true, if the pattern is empty, or the pattern ends with \| and magic is diff --git a/src/fileio.c b/src/fileio.c index 8318452dfc..e99eb9bb86 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -216,7 +216,7 @@ readfile( int using_b_ffname; int using_b_fname; static char *msg_is_a_directory = N_("is a directory"); - int eof; + int eof; au_did_filetype = FALSE; // reset before triggering any autocommands @@ -4784,7 +4784,7 @@ readdir_core( int withattr UNUSED, void *context, int (*checkitem)(void *context, void *item), - int sort) + int sort) { int failed = FALSE; char_u *p; diff --git a/src/filepath.c b/src/filepath.c index 09c9f4a198..56a99e40d7 100644 --- a/src/filepath.c +++ b/src/filepath.c @@ -1648,7 +1648,7 @@ f_readdir(typval_T *argvars, typval_T *rettv) char_u *p; garray_T ga; int i; - int sort = READDIR_SORT_BYTE; + int sort = READDIR_SORT_BYTE; if (rettv_list_alloc(rettv) == FAIL) return; @@ -1701,7 +1701,7 @@ f_readdirex(typval_T *argvars, typval_T *rettv) char_u *path; garray_T ga; int i; - int sort = READDIR_SORT_BYTE; + int sort = READDIR_SORT_BYTE; if (rettv_list_alloc(rettv) == FAIL) return; @@ -5371,7 +5371,7 @@ gui_do_findrepl( // escape slash and backslash p = vim_strsave_escaped(find_text, (char_u *)"/\\"); if (p != NULL) - ga_concat(&ga, p); + ga_concat(&ga, p); vim_free(p); if (flags & FRD_WHOLE_WORD) ga_concat(&ga, (char_u *)"\\>"); @@ -5445,7 +5445,7 @@ gui_do_findrepl( // direction p = vim_strsave_escaped(ga.ga_data, (char_u *)"?"); if (p != NULL) - (void)do_search(NULL, '?', '?', p, 1L, searchflags, NULL); + (void)do_search(NULL, '?', '?', p, 1L, searchflags, NULL); vim_free(p); } diff --git a/src/highlight.c b/src/highlight.c index 3f46a07276..75a310f53e 100644 --- a/src/highlight.c +++ b/src/highlight.c @@ -2356,7 +2356,7 @@ colorname2rgb(char_u *name) guicolor_T gui_get_color_cmn(char_u *name) { - int i; + int i; guicolor_T color; struct rgbcolor_table_S { diff --git a/src/if_lua.c b/src/if_lua.c index 956fd4d7c5..120ed7bbdd 100644 --- a/src/if_lua.c +++ b/src/if_lua.c @@ -949,29 +949,29 @@ luaV_list_newindex(lua_State *L) li = list_find(l, n); if (li == NULL) { - if (!lua_isnil(L, 3)) - { - typval_T v; - luaV_checktypval(L, 3, &v, "inserting list item"); - if (list_insert_tv(l, &v, li) == FAIL) - luaL_error(L, "failed to add item to list"); - clear_tv(&v); - } + if (!lua_isnil(L, 3)) + { + typval_T v; + luaV_checktypval(L, 3, &v, "inserting list item"); + if (list_insert_tv(l, &v, li) == FAIL) + luaL_error(L, "failed to add item to list"); + clear_tv(&v); + } } else { - if (lua_isnil(L, 3)) // remove? - { + if (lua_isnil(L, 3)) // remove? + { vimlist_remove(l, li, li); listitem_free(l, li); - } - else - { + } + else + { typval_T v; luaV_checktypval(L, 3, &v, "setting list item"); clear_tv(&li->li_tv); li->li_tv = v; - } + } } return 0; } diff --git a/src/indent.c b/src/indent.c index 0666f0e0d4..06d98f92ec 100644 --- a/src/indent.c +++ b/src/indent.c @@ -161,7 +161,7 @@ tabstop_start(colnr_T col, int ts, int *vts) int tabcount; colnr_T tabcol = 0; int t; - int excess; + int excess; if (vts == NULL || vts[0] == 0) return (col / ts) * ts; @@ -1804,7 +1804,7 @@ ex_retab(exarg_T *eap) && curbuf->b_p_ts == tabstop_first(new_vts_array)) ; // not changed else if (tabstop_count(curbuf->b_p_vts_array) > 0 - && tabstop_eq(curbuf->b_p_vts_array, new_vts_array)) + && tabstop_eq(curbuf->b_p_vts_array, new_vts_array)) ; // not changed else redraw_curbuf_later(NOT_VALID); diff --git a/src/insexpand.c b/src/insexpand.c index 86c6a1415e..6e38098642 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -1966,8 +1966,8 @@ ins_compl_set_original_text(char_u *str) p = vim_strsave(str); if (p != NULL) { - vim_free(compl_first_match->cp_prev->cp_str); - compl_first_match->cp_prev->cp_str = p; + vim_free(compl_first_match->cp_prev->cp_str); + compl_first_match->cp_prev->cp_str = p; } } } @@ -3176,7 +3176,7 @@ typedef struct * st->first_match_pos - position of the first completion match * st->last_match_pos - position of the last completion match * st->set_match_pos - TRUE if the first match position should be saved to - * avoid loops after the search wraps around. + * avoid loops after the search wraps around. * st->dict - name of the dictionary or thesaurus file to search * st->dict_f - flag specifying whether "dict" is an exact file name or not * @@ -530,7 +530,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) } // Allow empty string, "winpty", "conpty". if (!(*p == NUL || STRCMP(p, "winpty") == 0 - || STRCMP(p, "conpty") == 0)) + || STRCMP(p, "conpty") == 0)) { semsg(_(e_invalid_value_for_argument_str), "tty_type"); return FAIL; diff --git a/src/keymap.h b/src/keymap.h index e8832d62f6..6350772c72 100644 --- a/src/keymap.h +++ b/src/keymap.h @@ -276,7 +276,7 @@ enum key_extra , KE_CANCEL = 102 // return from vgetc() , KE_COMMAND = 103 // <Cmd> special key , KE_SCRIPT_COMMAND = 104 // <ScriptCmd> special key - , KE_S_BS = 105 // shift + <BS> + , KE_S_BS = 105 // shift + <BS> }; /* diff --git a/src/macros.h b/src/macros.h index 53733c7f7b..aa61d900ff 100644 --- a/src/macros.h +++ b/src/macros.h @@ -147,7 +147,7 @@ // see mch_open() comment # define mch_fopen(n, p) fopen(vms_fixfilename(n), (p)) # define mch_fstat(n, p) fstat((n), (p)) -# undef HAVE_LSTAT // VMS does not have lstat() +# undef HAVE_LSTAT // VMS does not have lstat() # define mch_stat(n, p) stat(vms_fixfilename(n), (p)) #else # ifndef MSWIN @@ -208,7 +208,7 @@ #define REPLACE_NORMAL(s) (((s) & REPLACE_FLAG) && !((s) & VREPLACE_FLAG)) #ifdef FEAT_ARABIC -# define ARABIC_CHAR(ch) (((ch) & 0xFF00) == 0x0600) +# define ARABIC_CHAR(ch) (((ch) & 0xFF00) == 0x0600) # define UTF_COMPOSINGLIKE(p1, p2) utf_composinglike((p1), (p2)) #else # define UTF_COMPOSINGLIKE(p1, p2) utf_iscomposing(utf_ptr2char(p2)) diff --git a/src/menu.c b/src/menu.c index 3c4236b86a..95f6fae956 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1638,7 +1638,7 @@ get_menu_cmd_modes( modes = MENU_INSERT_MODE; break; case 't': - if (*cmd == 'l') // tlmenu, tlunmenu, tlnoremenu + if (*cmd == 'l') // tlmenu, tlunmenu, tlnoremenu { modes = MENU_TERMINAL_MODE; ++cmd; diff --git a/src/misc1.c b/src/misc1.c index 7a5fecd104..9bbe3ad385 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -575,7 +575,8 @@ check_status(buf_T *buf) } /* - * Ask for a reply from the user, a 'y' or a 'n'. + * Ask for a reply from the user, a 'y' or a 'n', with prompt "str" (which + * should have been translated already). * No other characters are accepted, the message is repeated until a valid * reply is entered or CTRL-C is hit. * If direct is TRUE, don't use vgetc() but ui_inchar(), don't get characters @@ -653,7 +654,7 @@ get_mode(char_u *buf) { buf[i++] = VIsual_mode; if (restart_VIsual_select) - buf[i++] = 's'; + buf[i++] = 's'; } } else if (State == MODE_HITRETURN || State == MODE_ASKMORE diff --git a/src/misc2.c b/src/misc2.c index a22463110b..7840ea98f0 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -647,7 +647,7 @@ leftcol_changed(void) long lastcol; colnr_T s, e; int retval = FALSE; - long siso = get_sidescrolloff_value(); + long siso = get_sidescrolloff_value(); changed_cline_bef_curs(); lastcol = curwin->w_leftcol + curwin->w_width - curwin_col_off() - 1; diff --git a/src/mouse.c b/src/mouse.c index 005b944a03..af9186d72f 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -2284,7 +2284,7 @@ check_termcode_mouse( // ^----- column // ^-------- code // - // \033[<%d;%d;%dm : mouse release event + // \033[<%d;%d;%dm : mouse release event // ^-- row // ^----- column // ^-------- code @@ -2565,9 +2565,9 @@ check_termcode_mouse( * Pe, the event code indicates what event caused this report * The following event codes are defined: * 0 - request, the terminal received an explicit request for a - * locator report, but the locator is unavailable + * locator report, but the locator is unavailable * 1 - request, the terminal received an explicit request for a - * locator report + * locator report * 2 - left button down * 3 - left button up * 4 - middle button down diff --git a/src/move.c b/src/move.c index 5e31e71336..58bd97fe04 100644 --- a/src/move.c +++ b/src/move.c @@ -185,7 +185,7 @@ update_topline(void) #endif int check_topline = FALSE; int check_botline = FALSE; - long *so_ptr = curwin->w_p_so >= 0 ? &curwin->w_p_so : &p_so; + long *so_ptr = curwin->w_p_so >= 0 ? &curwin->w_p_so : &p_so; int save_so = *so_ptr; // If there is no valid screen and when the window height is zero just use @@ -435,7 +435,7 @@ check_top_offset(void) { lineoff_T loff; int n; - long so = get_scrolloff_value(); + long so = get_scrolloff_value(); if (curwin->w_cursor.lnum < curwin->w_topline + so #ifdef FEAT_FOLDING @@ -951,8 +951,8 @@ curs_columns( colnr_T startcol; colnr_T endcol; colnr_T prev_skipcol; - long so = get_scrolloff_value(); - long siso = get_sidescrolloff_value(); + long so = get_scrolloff_value(); + long siso = get_sidescrolloff_value(); /* * First make sure that w_topline is valid (after moving the cursor). @@ -1976,7 +1976,7 @@ scroll_cursor_bot(int min_scroll, int set_topbot) linenr_T old_valid = curwin->w_valid; int old_empty_rows = curwin->w_empty_rows; linenr_T cln; // Cursor Line Number - long so = get_scrolloff_value(); + long so = get_scrolloff_value(); cln = curwin->w_cursor.lnum; if (set_topbot) @@ -2270,7 +2270,7 @@ cursor_correct(void) int above_wanted, below_wanted; linenr_T cln; // Cursor Line Number int max_off; - long so = get_scrolloff_value(); + long so = get_scrolloff_value(); /* * How many lines we would like to have above/below the cursor depends on @@ -2390,7 +2390,7 @@ onepage(int dir, long count) int retval = OK; lineoff_T loff; linenr_T old_topline = curwin->w_topline; - long so = get_scrolloff_value(); + long so = get_scrolloff_value(); if (curbuf->b_ml.ml_line_count == 1) // nothing to do { diff --git a/src/normal.c b/src/normal.c index 96f83d3f31..1baf68a145 100644 --- a/src/normal.c +++ b/src/normal.c @@ -2644,7 +2644,7 @@ nv_zet(cmdarg_T *cap) long old_fdl = curwin->w_p_fdl; int old_fen = curwin->w_p_fen; #endif - long siso = get_sidescrolloff_value(); + long siso = get_sidescrolloff_value(); if (VIM_ISDIGIT(nchar) && !nv_z_get_count(cap, &nchar)) return; @@ -6307,7 +6307,7 @@ nv_redo_or_register(cmdarg_T *cap) // the unnamed register is 0 reg = 0; - VIsual_select_reg = valid_yank_reg(reg, TRUE) ? reg : 0; + VIsual_select_reg = valid_yank_reg(reg, TRUE) ? reg : 0; return; } @@ -625,7 +625,7 @@ op_delete(oparg_T *oap) if (VIsual_select && oap->is_VIsual) // use register given with CTRL_R, defaults to zero - oap->regname = VIsual_select_reg; + oap->regname = VIsual_select_reg; #ifdef FEAT_CLIPBOARD adjust_clip_reg(&oap->regname); @@ -1208,9 +1208,9 @@ op_replace(oparg_T *oap, int c) curwin->w_cursor.col -= (virtcols + 1); for (; virtcols >= 0; virtcols--) { - if ((*mb_char2len)(c) > 1) + if ((*mb_char2len)(c) > 1) replace_character(c); - else + else PBYTE(curwin->w_cursor, c); if (inc(&curwin->w_cursor) == -1) break; diff --git a/src/option.c b/src/option.c index 43f584d1d3..559e260ce9 100644 --- a/src/option.c +++ b/src/option.c @@ -489,7 +489,7 @@ set_init_1(int clean_arg) # ifdef VIMDLL (!gui.in_use && !gui.starting) && |