0
0
mirror of https://github.com/vim/vim.git synced 2025-07-24 10:45:12 -04:00

patch 9.0.0904: various comment and indent flaws

Problem:    Various comment and indent flaws.
Solution:   Improve comments and indenting.
This commit is contained in:
Bram Moolenaar 2022-11-18 22:14:09 +00:00
parent d13166e788
commit 88456cd3c4
14 changed files with 61 additions and 42 deletions

View File

@ -12,6 +12,7 @@ SRC_ALL = \
.github/workflows/ci.yml \ .github/workflows/ci.yml \
.github/workflows/codeql-analysis.yml \ .github/workflows/codeql-analysis.yml \
.github/workflows/coverity.yml \ .github/workflows/coverity.yml \
.github/dependabot.yml \
.gitignore \ .gitignore \
.hgignore \ .hgignore \
.lgtm.yml \ .lgtm.yml \
@ -396,6 +397,7 @@ SRC_ALL = \
src/libvterm/t/66screen_extent.test \ src/libvterm/t/66screen_extent.test \
src/libvterm/t/67screen_dbl_wh.test \ src/libvterm/t/67screen_dbl_wh.test \
src/libvterm/t/68screen_termprops.test \ src/libvterm/t/68screen_termprops.test \
src/libvterm/t/69screen_reflow.test \
src/libvterm/t/90vttest_01-movement-1.test \ src/libvterm/t/90vttest_01-movement-1.test \
src/libvterm/t/90vttest_01-movement-2.test \ src/libvterm/t/90vttest_01-movement-2.test \
src/libvterm/t/90vttest_01-movement-3.test \ src/libvterm/t/90vttest_01-movement-3.test \
@ -643,6 +645,7 @@ SRC_MAC = \
src/os_mac_conv.c \ src/os_mac_conv.c \
src/os_macosx.m \ src/os_macosx.m \
src/proto/os_mac_conv.pro \ src/proto/os_mac_conv.pro \
src/proto/os_macosx.pro \
# source files for VMS (in the extra archive) # source files for VMS (in the extra archive)
SRC_VMS = \ SRC_VMS = \

View File

@ -396,7 +396,9 @@ CClink = $(CC)
# MZSCHEME # MZSCHEME
# Uncomment this when you want to include the MzScheme interface. # Uncomment this when you want to include the MzScheme interface.
# You may have to build racket from source to make this work. # You may have to build racket from source to make this work. Version 7.9 has
# been reported to work, version 8.0 probably doesn't work, version 8.5 has
# been reported to work.
# NOTE: does not work well together with valgrind. # NOTE: does not work well together with valgrind.
#CONF_OPT_MZSCHEME = --enable-mzschemeinterp #CONF_OPT_MZSCHEME = --enable-mzschemeinterp
# PLT/mrscheme/drscheme Home dir; the PLTHOME environment variable also works # PLT/mrscheme/drscheme Home dir; the PLTHOME environment variable also works

View File

@ -1366,7 +1366,6 @@ get_lval(
if (rettv != NULL && lp->ll_dict->dv_scope != 0) if (rettv != NULL && lp->ll_dict->dv_scope != 0)
{ {
int prevval; int prevval;
int wrong;
if (len != -1) if (len != -1)
{ {
@ -1375,7 +1374,7 @@ get_lval(
} }
else else
prevval = 0; // avoid compiler warning prevval = 0; // avoid compiler warning
wrong = (lp->ll_dict->dv_scope == VAR_DEF_SCOPE int wrong = (lp->ll_dict->dv_scope == VAR_DEF_SCOPE
&& (rettv->v_type == VAR_FUNC && (rettv->v_type == VAR_FUNC
|| rettv->v_type == VAR_PARTIAL) || rettv->v_type == VAR_PARTIAL)
&& var_wrong_func_name(key, lp->ll_di == NULL)) && var_wrong_func_name(key, lp->ll_di == NULL))

View File

@ -89,6 +89,7 @@ win_id2wp(int id)
/* /*
* Return the window and tab pointer of window "id". * Return the window and tab pointer of window "id".
* Returns NULL when not found.
*/ */
win_T * win_T *
win_id2wp_tp(int id, tabpage_T **tpp) win_id2wp_tp(int id, tabpage_T **tpp)

View File

@ -968,18 +968,18 @@ noremap_keys(void)
* Insert a string in position 'offset' in the typeahead buffer (for "@r" * Insert a string in position 'offset' in the typeahead buffer (for "@r"
* and ":normal" command, vgetorpeek() and check_termcode()). * and ":normal" command, vgetorpeek() and check_termcode()).
* *
* If noremap is REMAP_YES, new string can be mapped again. * If "noremap" is REMAP_YES, new string can be mapped again.
* If noremap is REMAP_NONE, new string cannot be mapped again. * If "noremap" is REMAP_NONE, new string cannot be mapped again.
* If noremap is REMAP_SKIP, first char of new string cannot be mapped again, * If "noremap" is REMAP_SKIP, first char of new string cannot be mapped again,
* but abbreviations are allowed. * but abbreviations are allowed.
* If noremap is REMAP_SCRIPT, new string cannot be mapped again, except for * If "noremap" is REMAP_SCRIPT, new string cannot be mapped again, except for
* script-local mappings. * script-local mappings.
* If noremap is > 0, that many characters of the new string cannot be mapped. * If "noremap" is > 0, that many characters of the new string cannot be mapped.
* *
* If nottyped is TRUE, the string does not return KeyTyped (don't use when * If "nottyped" is TRUE, the string does not return KeyTyped (don't use when
* offset is non-zero!). * "offset" is non-zero!).
* *
* If silent is TRUE, cmd_silent is set when the characters are obtained. * If "silent" is TRUE, cmd_silent is set when the characters are obtained.
* *
* return FAIL for failure, OK otherwise * return FAIL for failure, OK otherwise
*/ */
@ -1601,8 +1601,8 @@ before_blocking(void)
} }
/* /*
* updatescript() is called when a character can be written into the script file * updatescript() is called when a character can be written into the script
* or when we have waited some time for a character (c == 0) * file or when we have waited some time for a character (c == 0)
* *
* All the changed memfiles are synced if c == 0 or when the number of typed * All the changed memfiles are synced if c == 0 or when the number of typed
* characters reaches 'updatecount' and 'updatecount' is non-zero. * characters reaches 'updatecount' and 'updatecount' is non-zero.

View File

@ -435,7 +435,7 @@ next_search_hl(
colnr_T matchcol; colnr_T matchcol;
long nmatched; long nmatched;
int called_emsg_before = called_emsg; int called_emsg_before = called_emsg;
int timed_out = FALSE; int timed_out = FALSE;
// for :{range}s/pat only highlight inside the range // for :{range}s/pat only highlight inside the range
if ((lnum < search_first_line || lnum > search_last_line) && cur == NULL) if ((lnum < search_first_line || lnum > search_last_line) && cur == NULL)

View File

@ -1311,9 +1311,8 @@ wait_return(int redraw)
|| c == K_X2MOUSE)) || c == K_X2MOUSE))
); );
ui_breakcheck(); ui_breakcheck();
/*
* Avoid that the mouse-up event causes visual mode to start. // Avoid that the mouse-up event causes Visual mode to start.
*/
if (c == K_LEFTMOUSE || c == K_MIDDLEMOUSE || c == K_RIGHTMOUSE if (c == K_LEFTMOUSE || c == K_MIDDLEMOUSE || c == K_RIGHTMOUSE
|| c == K_X1MOUSE || c == K_X2MOUSE) || c == K_X1MOUSE || c == K_X2MOUSE)
(void)jump_to_mouse(MOUSE_SETPOS, NULL, 0); (void)jump_to_mouse(MOUSE_SETPOS, NULL, 0);

View File

@ -2852,7 +2852,8 @@ cursor_correct(void)
static void get_scroll_overlap(lineoff_T *lp, int dir); static void get_scroll_overlap(lineoff_T *lp, int dir);
/* /*
* Move screen "count" pages up or down and update screen. * Move screen "count" pages up ("dir" is BACKWARD) or down ("dir" is FORWARD)
* and update the screen.
* *
* Return FAIL for failure, OK otherwise. * Return FAIL for failure, OK otherwise.
*/ */

View File

@ -2352,6 +2352,7 @@ mch_restore_title(int which)
/* /*
* Return TRUE if "name" looks like some xterm name. * Return TRUE if "name" looks like some xterm name.
* This matches "xterm.*", thus "xterm-256color", "xterm-kitty", etc.
* Seiichi Sato mentioned that "mlterm" works like xterm. * Seiichi Sato mentioned that "mlterm" works like xterm.
*/ */
int int
@ -2409,6 +2410,9 @@ use_xterm_mouse(void)
return 0; return 0;
} }
/*
* Return TRUE if "name" is an iris-ansi terminal name.
*/
int int
vim_is_iris(char_u *name) vim_is_iris(char_u *name)
{ {
@ -2418,14 +2422,18 @@ vim_is_iris(char_u *name)
|| STRCMP(name, "builtin_iris-ansi") == 0); || STRCMP(name, "builtin_iris-ansi") == 0);
} }
/*
* Return TRUE if "name" is a vt300-like terminal name.
*/
int int
vim_is_vt300(char_u *name) vim_is_vt300(char_u *name)
{ {
if (name == NULL) if (name == NULL)
return FALSE; // actually all ANSI comp. terminals should be here return FALSE;
// catch VT100 - VT5xx // Actually all ANSI compatible terminals should be here.
// Catch at least VT1xx - VT5xx
return ((STRNICMP(name, "vt", 2) == 0 return ((STRNICMP(name, "vt", 2) == 0
&& vim_strchr((char_u *)"12345", name[2]) != NULL) && vim_strchr((char_u *)"12345", name[2]) != NULL)
|| STRCMP(name, "builtin_vt320") == 0); || STRCMP(name, "builtin_vt320") == 0);
} }
@ -5011,8 +5019,7 @@ mch_call_shell_fork(
|| (!curbuf->b_p_bin || (!curbuf->b_p_bin
&& curbuf->b_p_fixeol) && curbuf->b_p_fixeol)
|| (lnum != curbuf->b_no_eol_lnum || (lnum != curbuf->b_no_eol_lnum
&& (lnum != && (lnum != curbuf->b_ml.ml_line_count
curbuf->b_ml.ml_line_count
|| curbuf->b_p_eol))) || curbuf->b_p_eol)))
vim_ignored = write(toshell_fd, "\n", vim_ignored = write(toshell_fd, "\n",
(size_t)1); (size_t)1);
@ -8309,8 +8316,8 @@ stop_timeout(void)
start_timeout(long msec) start_timeout(long msec)
{ {
struct itimerspec interval = { struct itimerspec interval = {
{0, 0}, // Do not repeat. {0, 0}, // Do not repeat.
{msec / 1000, (msec % 1000) * 1000000}}; // Timeout interval {msec / 1000, (msec % 1000) * 1000000}}; // Timeout interval
int ret; int ret;
// This is really the caller's responsibility, but let's make sure the // This is really the caller's responsibility, but let's make sure the
@ -8323,8 +8330,8 @@ start_timeout(long msec)
action.sigev_notify = SIGEV_THREAD; action.sigev_notify = SIGEV_THREAD;
action.sigev_notify_function = set_flag; action.sigev_notify_function = set_flag;
ret = timer_create(CLOCK_MONOTONIC, &action, &timer_id); ret = timer_create(CLOCK_MONOTONIC, &action, &timer_id);
if (ret < 0) if (ret < 0)
{ {
semsg(_(e_could_not_set_timeout_str), strerror(errno)); semsg(_(e_could_not_set_timeout_str), strerror(errno));
return &timeout_flag; return &timeout_flag;
@ -8362,10 +8369,10 @@ delete_timer(void)
* Implement timeout with setitimer() * Implement timeout with setitimer()
*/ */
static struct sigaction prev_sigaction; static struct sigaction prev_sigaction;
static volatile sig_atomic_t timeout_flag = FALSE; static volatile sig_atomic_t timeout_flag = FALSE;
static int timer_active = FALSE; static int timer_active = FALSE;
static int timer_handler_active = FALSE; static int timer_handler_active = FALSE;
static volatile sig_atomic_t alarm_pending = FALSE; static volatile sig_atomic_t alarm_pending = FALSE;
/* /*
* Handle SIGALRM for a timeout. * Handle SIGALRM for a timeout.
@ -8424,8 +8431,8 @@ stop_timeout(void)
start_timeout(long msec) start_timeout(long msec)
{ {
struct itimerval interval = { struct itimerval interval = {
{0, 0}, // Do not repeat. {0, 0}, // Do not repeat.
{msec / 1000, (msec % 1000) * 1000}}; // Timeout interval {msec / 1000, (msec % 1000) * 1000}}; // Timeout interval
struct sigaction handle_alarm; struct sigaction handle_alarm;
int ret; int ret;
sigset_t sigs; sigset_t sigs;

View File

@ -6782,8 +6782,7 @@ nfa_regmatch(
if (REG_MULTI && (lnum <= 0 if (REG_MULTI && (lnum <= 0
|| lnum > wp->w_buffer->b_ml.ml_line_count)) || lnum > wp->w_buffer->b_ml.ml_line_count))
lnum = 1; lnum = 1;
vcol = (long_u)win_linetabsize(wp, lnum, vcol = (long_u)win_linetabsize(wp, lnum, rex.line, col);
rex.line, col);
result = nfa_re_num_cmp(t->state->val, op, vcol + 1); result = nfa_re_num_cmp(t->state->val, op, vcol + 1);
} }
if (result) if (result)

View File

@ -76,7 +76,12 @@ func Test_fileformats()
call s:concat_files('XXMac', 'XXEol', 'XXMacEol') call s:concat_files('XXMac', 'XXEol', 'XXMacEol')
call s:concat_files('XXUxDs', 'XXMac', 'XXUxDsMc') call s:concat_files('XXUxDs', 'XXMac', 'XXUxDsMc')
new " The :bwipe commands below cause us to get back to the current buffer.
" Avoid stray errors for various 'fileformat' values which may cause a
" modeline to be misinterpreted by wiping the buffer and editing a new one.
only!
bwipe!
enew
" Test 1: try reading and writing with 'fileformats' empty " Test 1: try reading and writing with 'fileformats' empty
set fileformats= set fileformats=

View File

@ -1,11 +1,11 @@
" Test to verify that the three function lists, " Test to verify that the three function lists:
" "
" global_functions[] in src/evalfunc.c " - global_functions[] in src/evalfunc.c
" *functions* in runtime/doc/builtin.txt " - *functions* in runtime/doc/builtin.txt
" *function-list* in runtime/doc/usr_41.txt " - *function-list* in runtime/doc/usr_41.txt
" "
" contain the same functions and that the global_functions and ":help " contain the same functions and that the global_functions and
" functions" lists are in ASCII order. " ":help functions" lists are in ASCII order.
func Test_function_lists() func Test_function_lists()

View File

@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
904,
/**/ /**/
903, 903,
/**/ /**/

View File

@ -728,7 +728,8 @@ utf16_to_enc(short_u *str, int *lenp)
/* /*
* Convert from the active codepage to 'encoding'. * Convert from the active codepage to 'encoding'.
* Input is "str[str_size]". * Input is "str[str_size]".
* The result is in allocated memory: "out[outlen]". With terminating NUL. * The result is in allocated memory: "out[outlen]". "outlen" includes the
* terminating NUL.
*/ */
void void
acp_to_enc( acp_to_enc(