Patch 9.0.0904

3 views
Skip to first unread message

Bram Moolenaar

unread,
Nov 18, 2022, 5:14:52 PM11/18/22
to vim...@googlegroups.com

Patch 9.0.0904
Problem: Various comment and indent flaws.
Solution: Improve comments and indenting.
Files: Filelist, src/Makefile, src/eval.c, src/evalwindow.c,
src/getchar.c, src/match.c, src/message.c, src/move.c, src/os_unix.c,
src/regexp_nfa.c, src/winclip.c, src/testdir/test_fileformat.vim,
src/testdir/test_function_lists.vim


*** ../vim-9.0.0903/Filelist 2022-11-15 22:58:41.225439836 +0000
--- Filelist 2022-11-15 22:04:42.324500109 +0000
***************
*** 12,17 ****
--- 12,18 ----
.github/workflows/ci.yml \
.github/workflows/codeql-analysis.yml \
.github/workflows/coverity.yml \
+ .github/dependabot.yml \
.gitignore \
.hgignore \
.lgtm.yml \
***************
*** 396,401 ****
--- 397,403 ----
src/libvterm/t/66screen_extent.test \
src/libvterm/t/67screen_dbl_wh.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-2.test \
src/libvterm/t/90vttest_01-movement-3.test \
***************
*** 643,648 ****
--- 645,651 ----
src/os_mac_conv.c \
src/os_macosx.m \
src/proto/os_mac_conv.pro \
+ src/proto/os_macosx.pro \

# source files for VMS (in the extra archive)
SRC_VMS = \
*** ../vim-9.0.0903/src/Makefile 2022-10-08 19:26:35.698195391 +0100
--- src/Makefile 2022-11-17 16:40:33.256117696 +0000
***************
*** 396,402 ****

# MZSCHEME
# Uncomment this when you want to include the MzScheme interface.
! # You may have to build racket from source to make this work.
# NOTE: does not work well together with valgrind.
#CONF_OPT_MZSCHEME = --enable-mzschemeinterp
# PLT/mrscheme/drscheme Home dir; the PLTHOME environment variable also works
--- 396,404 ----

# MZSCHEME
# Uncomment this when you want to include the MzScheme interface.
! # 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.
#CONF_OPT_MZSCHEME = --enable-mzschemeinterp
# PLT/mrscheme/drscheme Home dir; the PLTHOME environment variable also works
*** ../vim-9.0.0903/src/eval.c 2022-11-05 20:21:50.597151474 +0000
--- src/eval.c 2022-11-05 20:27:32.365259421 +0000
***************
*** 1366,1372 ****
if (rettv != NULL && lp->ll_dict->dv_scope != 0)
{
int prevval;
- int wrong;

if (len != -1)
{
--- 1366,1371 ----
***************
*** 1375,1381 ****
}
else
prevval = 0; // avoid compiler warning
! wrong = (lp->ll_dict->dv_scope == VAR_DEF_SCOPE
&& (rettv->v_type == VAR_FUNC
|| rettv->v_type == VAR_PARTIAL)
&& var_wrong_func_name(key, lp->ll_di == NULL))
--- 1374,1380 ----
}
else
prevval = 0; // avoid compiler warning
! int wrong = (lp->ll_dict->dv_scope == VAR_DEF_SCOPE
&& (rettv->v_type == VAR_FUNC
|| rettv->v_type == VAR_PARTIAL)
&& var_wrong_func_name(key, lp->ll_di == NULL))
*** ../vim-9.0.0903/src/evalwindow.c 2022-11-01 11:44:12.690558580 +0000
--- src/evalwindow.c 2022-11-12 16:02:36.749667032 +0000
***************
*** 89,94 ****
--- 89,95 ----

/*
* Return the window and tab pointer of window "id".
+ * Returns NULL when not found.
*/
win_T *
win_id2wp_tp(int id, tabpage_T **tpp)
*** ../vim-9.0.0903/src/getchar.c 2022-11-02 13:30:37.534314540 +0000
--- src/getchar.c 2022-11-14 22:43:46.049388248 +0000
***************
*** 968,985 ****
* Insert a string in position 'offset' in the typeahead buffer (for "@r"
* and ":normal" command, vgetorpeek() and check_termcode()).
*
! * 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_SKIP, first char of new string cannot be mapped again,
* but abbreviations are allowed.
! * If noremap is REMAP_SCRIPT, new string cannot be mapped again, except for
* script-local mappings.
! * 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
! * offset is non-zero!).
*
! * If silent is TRUE, cmd_silent is set when the characters are obtained.
*
* return FAIL for failure, OK otherwise
*/
--- 968,985 ----
* Insert a string in position 'offset' in the typeahead buffer (for "@r"
* and ":normal" command, vgetorpeek() and check_termcode()).
*
! * 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_SKIP, first char of new string cannot be mapped again,
* but abbreviations are allowed.
! * If "noremap" is REMAP_SCRIPT, new string cannot be mapped again, except for
* script-local mappings.
! * 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
! * "offset" is non-zero!).
*
! * If "silent" is TRUE, cmd_silent is set when the characters are obtained.
*
* return FAIL for failure, OK otherwise
*/
***************
*** 1601,1608 ****
}

/*
! * updatescript() is called when a character can be written into the script 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
* characters reaches 'updatecount' and 'updatecount' is non-zero.
--- 1601,1608 ----
}

/*
! * updatescript() is called when a character can be written into the script
! * 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
* characters reaches 'updatecount' and 'updatecount' is non-zero.
*** ../vim-9.0.0903/src/match.c 2022-09-29 13:50:04.715222469 +0100
--- src/match.c 2022-10-13 11:52:53.918232097 +0100
***************
*** 435,441 ****
colnr_T matchcol;
long nmatched;
int called_emsg_before = called_emsg;
! int timed_out = FALSE;

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

// for :{range}s/pat only highlight inside the range
if ((lnum < search_first_line || lnum > search_last_line) && cur == NULL)
*** ../vim-9.0.0903/src/message.c 2022-10-13 22:12:07.168673806 +0100
--- src/message.c 2022-11-09 00:35:04.423587830 +0000
***************
*** 1311,1319 ****
|| c == K_X2MOUSE))
);
ui_breakcheck();
! /*
! * Avoid that the mouse-up event causes visual mode to start.
! */
if (c == K_LEFTMOUSE || c == K_MIDDLEMOUSE || c == K_RIGHTMOUSE
|| c == K_X1MOUSE || c == K_X2MOUSE)
(void)jump_to_mouse(MOUSE_SETPOS, NULL, 0);
--- 1311,1318 ----
|| c == K_X2MOUSE))
);
ui_breakcheck();
!
! // Avoid that the mouse-up event causes Visual mode to start.
if (c == K_LEFTMOUSE || c == K_MIDDLEMOUSE || c == K_RIGHTMOUSE
|| c == K_X1MOUSE || c == K_X2MOUSE)
(void)jump_to_mouse(MOUSE_SETPOS, NULL, 0);
*** ../vim-9.0.0903/src/move.c 2022-11-18 12:52:23.418570894 +0000
--- src/move.c 2022-11-18 17:22:58.760163363 +0000
***************
*** 2852,2858 ****
static void get_scroll_overlap(lineoff_T *lp, int dir);

/*
! * Move screen "count" pages up or down and update screen.
*
* Return FAIL for failure, OK otherwise.
*/
--- 2852,2859 ----
static void get_scroll_overlap(lineoff_T *lp, int dir);

/*
! * Move screen "count" pages up ("dir" is BACKWARD) or down ("dir" is FORWARD)
! * and update the screen.
*
* Return FAIL for failure, OK otherwise.
*/
*** ../vim-9.0.0903/src/os_unix.c 2022-10-08 13:49:41.889378451 +0100
--- src/os_unix.c 2022-11-18 22:02:50.692433239 +0000
***************
*** 2352,2357 ****
--- 2352,2358 ----

/*
* 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.
*/
int
***************
*** 2409,2414 ****
--- 2410,2418 ----
return 0;
}

+ /*
+ * Return TRUE if "name" is an iris-ansi terminal name.
+ */
int
vim_is_iris(char_u *name)
{
***************
*** 2418,2431 ****
|| STRCMP(name, "builtin_iris-ansi") == 0);
}

int
vim_is_vt300(char_u *name)
{
if (name == NULL)
! return FALSE; // actually all ANSI comp. terminals should be here
! // catch VT100 - VT5xx
return ((STRNICMP(name, "vt", 2) == 0
! && vim_strchr((char_u *)"12345", name[2]) != NULL)
|| STRCMP(name, "builtin_vt320") == 0);
}

--- 2422,2439 ----
|| STRCMP(name, "builtin_iris-ansi") == 0);
}

+ /*
+ * Return TRUE if "name" is a vt300-like terminal name.
+ */
int
vim_is_vt300(char_u *name)
{
if (name == NULL)
! return FALSE;
! // Actually all ANSI compatible terminals should be here.
! // Catch at least VT1xx - VT5xx
return ((STRNICMP(name, "vt", 2) == 0
! && vim_strchr((char_u *)"12345", name[2]) != NULL)
|| STRCMP(name, "builtin_vt320") == 0);
}

***************
*** 5011,5018 ****
|| (!curbuf->b_p_bin
&& curbuf->b_p_fixeol)
|| (lnum != curbuf->b_no_eol_lnum
! && (lnum !=
! curbuf->b_ml.ml_line_count
|| curbuf->b_p_eol)))
vim_ignored = write(toshell_fd, "\n",
(size_t)1);
--- 5019,5025 ----
|| (!curbuf->b_p_bin
&& curbuf->b_p_fixeol)
|| (lnum != curbuf->b_no_eol_lnum
! && (lnum != curbuf->b_ml.ml_line_count
|| curbuf->b_p_eol)))
vim_ignored = write(toshell_fd, "\n",
(size_t)1);
***************
*** 8309,8316 ****
start_timeout(long msec)
{
struct itimerspec interval = {
! {0, 0}, // Do not repeat.
! {msec / 1000, (msec % 1000) * 1000000}}; // Timeout interval
int ret;

// This is really the caller's responsibility, but let's make sure the
--- 8316,8323 ----
start_timeout(long msec)
{
struct itimerspec interval = {
! {0, 0}, // Do not repeat.
! {msec / 1000, (msec % 1000) * 1000000}}; // Timeout interval
int ret;

// This is really the caller's responsibility, but let's make sure the
***************
*** 8323,8330 ****

action.sigev_notify = SIGEV_THREAD;
action.sigev_notify_function = set_flag;
! ret = timer_create(CLOCK_MONOTONIC, &action, &timer_id);
! if (ret < 0)
{
semsg(_(e_could_not_set_timeout_str), strerror(errno));
return &timeout_flag;
--- 8330,8337 ----

action.sigev_notify = SIGEV_THREAD;
action.sigev_notify_function = set_flag;
! ret = timer_create(CLOCK_MONOTONIC, &action, &timer_id);
! if (ret < 0)
{
semsg(_(e_could_not_set_timeout_str), strerror(errno));
return &timeout_flag;
***************
*** 8362,8371 ****
* Implement timeout with setitimer()
*/
static struct sigaction prev_sigaction;
! static volatile sig_atomic_t timeout_flag = FALSE;
! static int timer_active = FALSE;
static int timer_handler_active = FALSE;
! static volatile sig_atomic_t alarm_pending = FALSE;

/*
* Handle SIGALRM for a timeout.
--- 8369,8378 ----
* Implement timeout with setitimer()
*/
static struct sigaction prev_sigaction;
! static volatile sig_atomic_t timeout_flag = FALSE;
! static int timer_active = FALSE;
static int timer_handler_active = FALSE;
! static volatile sig_atomic_t alarm_pending = FALSE;

/*
* Handle SIGALRM for a timeout.
***************
*** 8424,8431 ****
start_timeout(long msec)
{
struct itimerval interval = {
! {0, 0}, // Do not repeat.
! {msec / 1000, (msec % 1000) * 1000}}; // Timeout interval
struct sigaction handle_alarm;
int ret;
sigset_t sigs;
--- 8431,8438 ----
start_timeout(long msec)
{
struct itimerval interval = {
! {0, 0}, // Do not repeat.
! {msec / 1000, (msec % 1000) * 1000}}; // Timeout interval
struct sigaction handle_alarm;
int ret;
sigset_t sigs;
*** ../vim-9.0.0903/src/regexp_nfa.c 2022-09-08 12:17:02.006342437 +0100
--- src/regexp_nfa.c 2022-10-14 14:50:19.550977110 +0100
***************
*** 6782,6789 ****
if (REG_MULTI && (lnum <= 0
|| lnum > wp->w_buffer->b_ml.ml_line_count))
lnum = 1;
! vcol = (long_u)win_linetabsize(wp, lnum,
! rex.line, col);
result = nfa_re_num_cmp(t->state->val, op, vcol + 1);
}
if (result)
--- 6782,6788 ----
if (REG_MULTI && (lnum <= 0
|| lnum > wp->w_buffer->b_ml.ml_line_count))
lnum = 1;
! vcol = (long_u)win_linetabsize(wp, lnum, rex.line, col);
result = nfa_re_num_cmp(t->state->val, op, vcol + 1);
}
if (result)
*** ../vim-9.0.0903/src/winclip.c 2021-12-27 17:12:39.000000000 +0000
--- src/winclip.c 2022-10-12 13:18:44.444515312 +0100
***************
*** 728,734 ****
/*
* Convert from the active codepage to 'encoding'.
* Input is "str[str_size]".
! * The result is in allocated memory: "out[outlen]". With terminating NUL.
*/
void
acp_to_enc(
--- 728,735 ----
/*
* Convert from the active codepage to 'encoding'.
* Input is "str[str_size]".
! * The result is in allocated memory: "out[outlen]". "outlen" includes the
! * terminating NUL.
*/
void
acp_to_enc(
*** ../vim-9.0.0903/src/testdir/test_fileformat.vim 2022-09-27 19:34:30.658212345 +0100
--- src/testdir/test_fileformat.vim 2022-11-06 14:11:19.958092681 +0000
***************
*** 76,82 ****
call s:concat_files('XXMac', 'XXEol', 'XXMacEol')
call s:concat_files('XXUxDs', 'XXMac', 'XXUxDsMc')

! new

" Test 1: try reading and writing with 'fileformats' empty
set fileformats=
--- 76,87 ----
call s:concat_files('XXMac', 'XXEol', 'XXMacEol')
call s:concat_files('XXUxDs', 'XXMac', 'XXUxDsMc')

! " 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
set fileformats=
*** ../vim-9.0.0903/src/testdir/test_function_lists.vim 2022-09-27 19:34:30.658212345 +0100
--- src/testdir/test_function_lists.vim 2022-11-18 22:08:22.396053200 +0000
***************
*** 1,11 ****
! " Test to verify that the three function lists,
"
! " global_functions[] in src/evalfunc.c
! " *functions* in runtime/doc/builtin.txt
! " *function-list* in runtime/doc/usr_41.txt
"
! " contain the same functions and that the global_functions and ":help
! " functions" lists are in ASCII order.

func Test_function_lists()

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

func Test_function_lists()

*** ../vim-9.0.0903/src/version.c 2022-11-18 21:20:21.811312017 +0000
--- src/version.c 2022-11-18 21:52:22.848157045 +0000
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 904,
/**/

--
From "know your smileys":
@:-() Elvis Presley

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages