Compare commits

...

7 Commits

Author SHA1 Message Date
2095148277 patch 8.0.1425: execute() does not work in completion of user command
Problem:    execute() does not work in completion of user command. (thinca)
Solution:   Switch off redir_off and restore it. (Ozaki Kiichi, closes #2492)
2017-12-25 13:44:43 +01:00
df980db69b update a few runtime files 2017-12-24 13:22:00 +01:00
a47ebdbd22 patch 8.0.1424: the timer_pause test is flaky on Travis
Problem:    The timer_pause test is flaky on Travis.
Solution:   Accept a longer sleep time on Mac.
2017-12-23 18:41:35 +01:00
fabaf753e2 patch 8.0.1423: error in return not caught by try/catch
Problem:    Error in return not caught by try/catch.
Solution:   Call update_force_abort(). (Yasuhiro Matsomoto, closes #2483)
2017-12-23 17:26:11 +01:00
45a0000d5c patch 8.0.1422: no fallback to underline when undercurl is not set
Problem:    No fallback to underline when undercurl is not set. (Ben Jackson)
Solution:   Check for the value to be empty instead of NULL. (closes #2424)
2017-12-22 21:12:34 +01:00
e6640ad44e patch 8.0.1421: accessing invalid memory with overlong byte sequence
Problem:    Accessing invalid memory with overlong byte sequence.
Solution:   Check for NUL character. (test by Dominique Pelle, closes #2485)
2017-12-22 21:06:56 +01:00
3c09722600 patch 8.0.1420: accessing freed memory in vimgrep
Problem:    Accessing freed memory in vimgrep.
Solution:   Check that the quickfix list is still valid. (Yegappan Lakshmanan,
            closes #2474)
2017-12-21 20:54:49 +01:00
22 changed files with 278 additions and 68 deletions

View File

@ -1,4 +1,4 @@
*options.txt* For Vim version 8.0. Last change: 2017 Dec 01
*options.txt* For Vim version 8.0. Last change: 2017 Dec 21
VIM REFERENCE MANUAL by Bram Moolenaar
@ -5749,11 +5749,11 @@ A jump table for the options with a short description can be found at |Q_op|.
copy of the original file will be kept. The name of the copy is the
name of the original file with the string in the 'patchmode' option
appended. This option should start with a dot. Use a string like
".org". 'backupdir' must not be empty for this to work (Detail: The
backup file is renamed to the patchmode file after the new file has
been successfully written, that's why it must be possible to write a
backup file). If there was no file to be backed up, an empty file is
created.
".orig" or ".org". 'backupdir' must not be empty for this to work
(Detail: The backup file is renamed to the patchmode file after the
new file has been successfully written, that's why it must be possible
to write a backup file). If there was no file to be backed up, an
empty file is created.
When the 'backupskip' pattern matches, a patchmode file is not made.
Using 'patchmode' for compressed files appends the extension at the
end (e.g., "file.gz.orig"), thus the resulting name isn't always

View File

@ -1,4 +1,4 @@
*syntax.txt* For Vim version 8.0. Last change: 2017 Sep 30
*syntax.txt* For Vim version 8.0. Last change: 2017 Dec 22
VIM REFERENCE MANUAL by Bram Moolenaar
@ -5031,6 +5031,8 @@ TabLine tab pages line, not active tab page label
TabLineFill tab pages line, where there are no labels
*hl-TabLineSel*
TabLineSel tab pages line, active tab page label
*hl-Terminal*
Terminal |terminal| window (see |terminal-size-color|)
*hl-Title*
Title titles for output from ":set all", ":autocmd" etc.
*hl-Visual*

View File

@ -6828,6 +6828,7 @@ hl-StatusLineNC syntax.txt /*hl-StatusLineNC*
hl-TabLine syntax.txt /*hl-TabLine*
hl-TabLineFill syntax.txt /*hl-TabLineFill*
hl-TabLineSel syntax.txt /*hl-TabLineSel*
hl-Terminal syntax.txt /*hl-Terminal*
hl-Title syntax.txt /*hl-Title*
hl-Tooltip syntax.txt /*hl-Tooltip*
hl-User1 syntax.txt /*hl-User1*
@ -8064,6 +8065,7 @@ quake.vim syntax.txt /*quake.vim*
quickfix quickfix.txt /*quickfix*
quickfix-6 version6.txt /*quickfix-6*
quickfix-ID quickfix.txt /*quickfix-ID*
quickfix-changedtick quickfix.txt /*quickfix-changedtick*
quickfix-context quickfix.txt /*quickfix-context*
quickfix-directory-stack quickfix.txt /*quickfix-directory-stack*
quickfix-error-lists quickfix.txt /*quickfix-error-lists*

View File

@ -1,4 +1,4 @@
*terminal.txt* For Vim version 8.0. Last change: 2017 Dec 17
*terminal.txt* For Vim version 8.0. Last change: 2017 Dec 22
VIM REFERENCE MANUAL by Bram Moolenaar
@ -122,7 +122,8 @@ and background colors are taken from Vim, the Normal highlight group.
For a color terminal the 'background' option is used to decide whether the
terminal window will start with a white or black background.
To use a different color the Terminal highlight group can be used: >
To use a different color the Terminal highlight group can be used, for
example: >
hi Terminal ctermbg=lightgrey ctermfg=blue guibg=lightgrey guifg=blue

View File

@ -1,4 +1,4 @@
*todo.txt* For Vim version 8.0. Last change: 2017 Dec 17
*todo.txt* For Vim version 8.0. Last change: 2017 Dec 23
VIM REFERENCE MANUAL by Bram Moolenaar
@ -142,11 +142,19 @@ Suggested by Hiroki Kokubun:
Include solarized color scheme?, it does not support termguicolors.
- Sanitized version of pablo (Lifepillar, 2017 Nov 21)
heap use after free. (gy741, #2447)
heap use after free in set_bufref (gy741, #2448)
reproduces with valgrind (Dominique)
heap use after free in getout. (gy741, #2449)
reproduces with valgrind (Dominique)
Reproducible:
invalid memory access in regexp with zero-width.
reproduced by Dominique, 2017 Dec 23
heap-use-after-free in win_equal_rec (#2467)
au* 0 vs¡
ar0
arga
al
al
Errors found with random data:
heap-buffer-overflow in alist_add (#2472)
heap-buffer-overflow in del_bytes (#2466)
Compiler warnings (geeknik, 2017 Oct 26):
- signed integer overflow in do_sub() (#2249)
@ -155,20 +163,13 @@ Compiler warnings (geeknik, 2017 Oct 26):
- signed integer overflow in nfa_regatom() (#2251)
- undefined left shift in get_string_tv() (#2250)
Triggering CursorHoldI happens too often in the GUI. (#2451).
Should move code from os_unix.c mch_inchar() up into common use, it's not
really machine specific. Also the part of WaitForChar(), it deals with timers
and is also for all machines.
When starting with --clean packages under "start" are not loaded. Make this
work: :packadd START {name} similar to :runtime START name
balloon_show() does not work properly in the terminal. (Ben Jackson, 2017 Dec
20, #2481)
Also see #2352, want better control over balloon, perhaps set the position.
When using :packadd files under "later" are not used, which is inconsistent
with packages under "start". (xtal8, #1994)
Patch to add changedtick var to quickfix list. (Yegappan Lakshmanan, 2017 Nov
18, #2391)
7 Add a watchpoint in the debug mode: An expression that breaks execution
when evaluating to non-zero. Add the "watchadd expr" command, stop when
the value of the expression changes. ":watchdel" deletes an item,
@ -212,6 +213,9 @@ Error in emsg with buggy script. (Dominique, 2017 Apr 30)
Patch to avoid clearing the intro message on Win32 console.
(Ken Takata, 2017 Nov 14)
Patch to fix encoding in print document name (Yasuhiro Matsumoto, 2017 Dec 20,
#2478)
Patch to copy buffer-local options before buffer leaves the window. (Bjorn
Linse, 2017 Nov 14, #2336)
@ -233,6 +237,9 @@ Ask whether to use Windows or Vim key behavior?
Patch for improving detecting Ruby on Mac in configure. (Ilya Mikhaltsou, 2017
Nov 21)
Add a ModeChanged autocommand that has an argument indicating the old and new
mode. Also used for switching Terminal mode.
When using command line window, CmdlineLeave is triggered without
CmdlineEnter. (xtal8, 2017 Oct 30, #2263)
Add some way to get the nested state. Although CmdwinEnter is obviously
@ -271,6 +278,7 @@ The ":move" command does not honor closed folds. (Ryan Lue, #2351)
Memory leaks in test_channel? (or is it because of fork())
Memory leak in test_arabic.
Using uninitialized value in test_crypt.
Memory leaks in test_escaped_glob
Patch to clear background when "guibg=NONE" is used and 'termguicolors' is
set.
@ -1052,8 +1060,6 @@ Patch to open folds for 'incsearch'. (Christian Brabandt, 2015 Jan 6)
Patch for building a 32bit Vim with 64bit MingW compiler.
(Michael Soyka, 2014 Oct 15)
Delete old code in os_msdos.c, mch_FullName().
Patch: On MS-Windows shellescape() may have to triple double quotes.
(Ingo Karkat, 2015 Jan 16)

View File

@ -0,0 +1,16 @@
" Vim filetype plugin
" Language: CMake
" Maintainer: Keith Smiley <keithbsmiley@gmail.com>
" Last Change: 2017 Dec 24
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
finish
endif
" Don't load another plugin for this buffer
let b:did_ftplugin = 1
let b:undo_ftplugin = "setl commentstring<"
setlocal commentstring=#\ %s

View File

@ -2,7 +2,7 @@
" Language: MIX (Donald Knuth's assembly language used in TAOCP)
" Maintainer: Wu Yongwei <wuyongwei@gmail.com>
" Filenames: *.mixal *.mix
" Last Change: 2013 Nov 13
" Last Change: 2017-11-26 15:21:36 +0800
" Quit when a syntax file was already loaded
if exists("b:current_syntax")
@ -16,7 +16,7 @@ syn case ignore
" Special processing of ALF directive: implementations vary whether quotation
" marks are needed
syn match mixAlfParam #\s\{1,2\}"\?[^"]\{,5\}"\?# contains=mixAlfDirective,mixString nextgroup=mixEndComment contained
syn match mixAlfParam #\s\{1,2\}"\?[^"]\{,5\}"\?# contains=mixString nextgroup=mixEndComment contained
" Region for parameters
syn match mixParam #[-+*/:=0-9a-z,()"]\+# contains=mixIdentifier,mixSpecial,mixNumber,mixString,mixLabel nextgroup=mixEndComment contained
@ -46,6 +46,7 @@ syn keyword mixDirective ALF nextgroup=mixAlfParam contained
" Opcodes
syn keyword mixOpcode NOP HLT NUM CHAR FLOT FIX nextgroup=mixEndComment contained
syn keyword mixOpcode FADD FSUB FMUL FDIV FCMP MOVE ADD SUB MUL DIV IOC IN OUT JRED JBUS JMP JSJ JOV JNOV JL JE JG JLE JNE JGE SLA SRA SLAX SRAX SLC SRC nextgroup=mixParam contained skipwhite
syn keyword mixOpcode SLB SRB JAE JAO JXE JXO nextgroup=mixParam contained skipwhite
syn match mixOpcode "LD[AX1-6]N\?\>" nextgroup=mixParam contained skipwhite
syn match mixOpcode "ST[AX1-6JZ]\>" nextgroup=mixParam contained skipwhite
@ -58,7 +59,7 @@ syn match mixOpcode "J[AX1-6]N\?[NZP]\>" nextgroup=mixParam contained skipwhite
" Switch back to being case sensitive
syn case match
" Registers (only to used in comments now)
" Registers (only to be used in comments now)
syn keyword mixRegister rA rX rI1 rI2 rI3 rI4 rI5 rI6 rJ contained
" The default highlighting

View File

@ -2147,6 +2147,7 @@ test_arglist \
test_edit \
test_erasebackword \
test_escaped_glob \
test_eval_stuff \
test_ex_undo \
test_ex_z \
test_exec_while_if \

View File

@ -2886,6 +2886,7 @@ f_execute(typval_T *argvars, typval_T *rettv)
int save_emsg_silent = emsg_silent;
int save_emsg_noredir = emsg_noredir;
int save_redir_execute = redir_execute;
int save_redir_off = redir_off;
garray_T save_ga;
rettv->vval.v_string = NULL;
@ -2928,6 +2929,7 @@ f_execute(typval_T *argvars, typval_T *rettv)
save_ga = redir_execute_ga;
ga_init2(&redir_execute_ga, (int)sizeof(char), 500);
redir_execute = TRUE;
redir_off = FALSE;
if (cmd != NULL)
do_cmdline_cmd(cmd);
@ -2958,6 +2960,7 @@ f_execute(typval_T *argvars, typval_T *rettv)
redir_execute = save_redir_execute;
if (redir_execute)
redir_execute_ga = save_ga;
redir_off = save_redir_off;
/* "silent reg" or "silent echo x" leaves msg_col somewhere in the
* line. Put it back in the first column. */

View File

@ -1622,11 +1622,17 @@ strup_save(char_u *orig)
char_u *s;
c = utf_ptr2char(p);
l = utf_ptr2len(p);
if (c == 0)
{
/* overlong sequence, use only the first byte */
c = *p;
l = 1;
}
uc = utf_toupper(c);
/* Reallocate string when byte count changes. This is rare,
* thus it's OK to do another malloc()/free(). */
l = utf_ptr2len(p);
newl = utf_char2len(uc);
if (newl != l)
{
@ -1685,11 +1691,17 @@ strlow_save(char_u *orig)
char_u *s;
c = utf_ptr2char(p);
l = utf_ptr2len(p);
if (c == 0)
{
/* overlong sequence, use only the first byte */
c = *p;
l = 1;
}
lc = utf_tolower(c);
/* Reallocate string when byte count changes. This is rare,
* thus it's OK to do another malloc()/free(). */
l = utf_ptr2len(p);
newl = utf_char2len(lc);
if (newl != l)
{

View File

@ -144,6 +144,7 @@ static int qf_get_fnum(qf_info_T *qi, int qf_idx, char_u *, char_u *);
static char_u *qf_push_dir(char_u *, struct dir_stack_T **, int is_file_stack);
static char_u *qf_pop_dir(struct dir_stack_T **);
static char_u *qf_guess_filepath(qf_info_T *qi, int qf_idx, char_u *);
static int qflist_valid(win_T *wp, int_u qf_id);
static void qf_fmt_text(char_u *text, char_u *buf, int bufsize);
static void qf_clean_dir_stack(struct dir_stack_T **);
static int qf_win_pos_update(qf_info_T *qi, int old_qf_index);
@ -177,6 +178,9 @@ static qf_info_T *ll_get_or_alloc_list(win_T *);
static char_u *qf_last_bufname = NULL;
static bufref_T qf_last_bufref = {NULL, 0, 0};
static char *e_loc_list_changed =
N_("E926: Current location list was changed");
/*
* Read the errorfile "efile" into memory, line by line, building the error
* list. Set the error list's title to qf_title.
@ -1927,6 +1931,29 @@ qf_guess_filepath(qf_info_T *qi, int qf_idx, char_u *filename)
return ds_ptr==NULL? NULL: ds_ptr->dirname;
}
/*
* Returns TRUE if a quickfix/location list with the given identifier exists.
*/
static int
qflist_valid (win_T *wp, int_u qf_id)
{
qf_info_T *qi = &ql_info;
int i;
if (wp != NULL)
{
qi = GET_LOC_LIST(wp); /* Location list */
if (qi == NULL)
return FALSE;
}
for (i = 0; i < qi->qf_listcount; ++i)
if (qi->qf_lists[i].qf_id == qf_id)
return TRUE;
return FALSE;
}
/*
* When loading a file from the quickfix, the auto commands may modify it.
* This may invalidate the current quickfix entry. This function checks
@ -2343,14 +2370,28 @@ qf_jump_edit_buffer(
else
{
int old_qf_curlist = qi->qf_curlist;
int save_qfid = qi->qf_lists[qi->qf_curlist].qf_id;
retval = buflist_getfile(qf_ptr->qf_fnum,
(linenr_T)1, GETF_SETMARK | GETF_SWITCH, forceit);
if (qi != &ql_info && !win_valid_any_tab(oldwin))
if (qi != &ql_info)
{
EMSG(_("E924: Current window was closed"));
*abort = TRUE;
*opened_window = FALSE;
/*
* Location list. Check whether the associated window is still
* present and the list is still valid.
*/
if (!win_valid_any_tab(oldwin))
{
EMSG(_("E924: Current window was closed"));
*abort = TRUE;
*opened_window = FALSE;
}
else if (!qflist_valid(oldwin, save_qfid))
{
EMSG(_(e_loc_list_changed));
*abort = TRUE;
}
}
else if (old_qf_curlist != qi->qf_curlist
|| !is_qf_entry_present(qi, qf_ptr))
@ -2358,7 +2399,7 @@ qf_jump_edit_buffer(
if (qi == &ql_info)
EMSG(_("E925: Current quickfix was changed"));
else
EMSG(_("E926: Current location list was changed"));
EMSG(_(e_loc_list_changed));
*abort = TRUE;
}
@ -4065,6 +4106,7 @@ ex_cfile(exarg_T *eap)
qf_info_T *qi = &ql_info;
#ifdef FEAT_AUTOCMD
char_u *au_name = NULL;
int save_qfid;
#endif
int res;
@ -4122,8 +4164,15 @@ ex_cfile(exarg_T *eap)
if (res >= 0 && qi != NULL)
qf_list_changed(qi, qi->qf_curlist);
#ifdef FEAT_AUTOCMD
save_qfid = qi->qf_lists[qi->qf_curlist].qf_id;
if (au_name != NULL)
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, NULL, FALSE, curbuf);
/*
* Autocmd might have freed the quickfix/location list. Check whether it is
* still valid
*/
if (!qflist_valid(wp, save_qfid))
return;
#endif
if (res > 0 && (eap->cmdidx == CMD_cfile || eap->cmdidx == CMD_lfile))
{
@ -4149,8 +4198,11 @@ ex_vimgrep(exarg_T *eap)
char_u *p;
int fi;
qf_info_T *qi = &ql_info;
int loclist_cmd = FALSE;
#ifdef FEAT_AUTOCMD
int_u save_qfid;
qfline_T *cur_qf_start;
win_T *wp;
#endif
long lnum;
buf_T *buf;
@ -4204,6 +4256,7 @@ ex_vimgrep(exarg_T *eap)
qi = ll_get_or_alloc_list(curwin);
if (qi == NULL)
return;
loclist_cmd = TRUE;
}
if (eap->addr_count > 0)
@ -4274,8 +4327,9 @@ ex_vimgrep(exarg_T *eap)
mch_dirname(dirname_start, MAXPATHL);
#ifdef FEAT_AUTOCMD
/* Remember the value of qf_start, so that we can check for autocommands
* changing the current quickfix list. */
/* Remember the current values of the quickfix list and qf_start, so that
* we can check for autocommands changing the current quickfix list. */
save_qfid = qi->qf_lists[qi->qf_curlist].qf_id;
cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start;
#endif
@ -4335,6 +4389,18 @@ ex_vimgrep(exarg_T *eap)
using_dummy = FALSE;
#ifdef FEAT_AUTOCMD
if (loclist_cmd)
{
/*
* Verify that the location list is still valid. An autocmd might
* have freed the location list.
*/
if (!qflist_valid(curwin, save_qfid))
{
EMSG(_(e_loc_list_changed));
goto theend;
}
}
if (cur_qf_start != qi->qf_lists[qi->qf_curlist].qf_start)
{
int idx;
@ -4491,6 +4557,13 @@ ex_vimgrep(exarg_T *eap)
if (au_name != NULL)
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
curbuf->b_fname, TRUE, curbuf);
/*
* The QuickFixCmdPost autocmd may free the quickfix list. Check the list
* is still valid.
*/
wp = loclist_cmd ? curwin : NULL;
if (!qflist_valid(wp, save_qfid))
goto theend;
#endif
/* Jump to first match. */
@ -5543,7 +5616,8 @@ ex_cbuffer(exarg_T *eap)
#endif
/* Must come after autocommands. */
if (eap->cmdidx == CMD_lbuffer || eap->cmdidx == CMD_lgetbuffer
if (eap->cmdidx == CMD_lbuffer
|| eap->cmdidx == CMD_lgetbuffer
|| eap->cmdidx == CMD_laddbuffer)
{
qi = ll_get_or_alloc_list(curwin);
@ -5614,14 +5688,6 @@ ex_cexpr(exarg_T *eap)
#endif
int res;
if (eap->cmdidx == CMD_lexpr || eap->cmdidx == CMD_lgetexpr
|| eap->cmdidx == CMD_laddexpr)
{
qi = ll_get_or_alloc_list(curwin);
if (qi == NULL)
return;
}
#ifdef FEAT_AUTOCMD
switch (eap->cmdidx)
{
@ -5643,6 +5709,15 @@ ex_cexpr(exarg_T *eap)
}
#endif
if (eap->cmdidx == CMD_lexpr
|| eap->cmdidx == CMD_lgetexpr
|| eap->cmdidx == CMD_laddexpr)
{
qi = ll_get_or_alloc_list(curwin);
if (qi == NULL)
return;
}
/* Evaluate the expression. When the result is a string or a list we can
* use it to fill the errorlist. */
tv = eval_expr(eap->arg, NULL);

View File

@ -8041,7 +8041,7 @@ screen_start_highlight(int attr)
else
attr = aep->ae_attr;
}
if ((attr & HL_BOLD) && T_MD != NULL) /* bold */
if ((attr & HL_BOLD) && *T_MD != NUL) /* bold */
out_str(T_MD);
else if (aep != NULL && cterm_normal_fg_bold &&
#ifdef FEAT_TERMGUICOLORS
@ -8056,19 +8056,19 @@ screen_start_highlight(int attr)
/* If the Normal FG color has BOLD attribute and the new HL
* has a FG color defined, clear BOLD. */
out_str(T_ME);
if ((attr & HL_STANDOUT) && T_SO != NULL) /* standout */
if ((attr & HL_STANDOUT) && *T_SO != NUL) /* standout */
out_str(T_SO);
if ((attr & HL_UNDERCURL) && T_UCS != NULL) /* undercurl */
if ((attr & HL_UNDERCURL) && *T_UCS != NUL) /* undercurl */
out_str(T_UCS);
if (((attr & HL_UNDERLINE) /* underline or undercurl */
|| ((attr & HL_UNDERCURL) && T_UCS == NULL))
&& T_US != NULL)
|| ((attr & HL_UNDERCURL) && *T_UCS == NUL))
&& *T_US != NUL)
out_str(T_US);
if ((attr & HL_ITALIC) && T_CZH != NULL) /* italic */
if ((attr & HL_ITALIC) && *T_CZH != NUL) /* italic */
out_str(T_CZH);
if ((attr & HL_INVERSE) && T_MR != NULL) /* inverse (reverse) */
if ((attr & HL_INVERSE) && *T_MR != NUL) /* inverse (reverse) */
out_str(T_MR);
if ((attr & HL_STRIKETHROUGH) && T_STS != NULL) /* strike */
if ((attr & HL_STRIKETHROUGH) && *T_STS != NUL) /* strike */
out_str(T_STS);
/*
@ -8180,7 +8180,7 @@ screen_stop_highlight(void)
else
out_str(T_SE);
}
if ((screen_attr & HL_UNDERCURL) && T_UCE != NULL)
if ((screen_attr & HL_UNDERCURL) && *T_UCE != NUL)
{
if (STRCMP(T_UCE, T_ME) == 0)
do_ME = TRUE;
@ -8188,7 +8188,7 @@ screen_stop_highlight(void)
out_str(T_UCE);
}
if ((screen_attr & HL_UNDERLINE)
|| ((screen_attr & HL_UNDERCURL) && T_UCE == NULL))
|| ((screen_attr & HL_UNDERCURL) && *T_UCE == NUL))
{
if (STRCMP(T_UE, T_ME) == 0)
do_ME = TRUE;

View File

@ -94,6 +94,7 @@ NEW_TESTS = test_arabic.res \
test_edit.res \
test_erasebackword.res \
test_escaped_glob.res \
test_eval_stuff.res \
test_exec_while_if.res \
test_exists.res \
test_exists_autocmd.res \

View File

@ -1178,10 +1178,3 @@ func Test_nocatch_wipe_dummy_buffer()
call assert_fails('lv½ /x', 'E480')
au!
endfunc
func Test_wipe_cbuffer()
sv x
au * * bw
lb
au!
endfunc

View File

@ -1,5 +1,7 @@
Test for various eval features. vim: set ft=vim :
NOTE: Do not add more here, use new style test test_eval_stuff.vim
Note: system clipboard is saved, changed and restored.
clipboard contents
@ -134,10 +136,10 @@ if has('clipboard')
let _clipreg = ['*', getreg('*'), getregtype('*')]
let _clipopt = &cb
let &cb='unnamed'
5y
7y
AR *
tabdo :windo :echo "hi"
6y
8y
AR *
let &cb=_clipopt
call call('setreg', _clipreg)

View File

@ -0,0 +1,13 @@
" Tests for various eval things.
function s:foo() abort
try
return [] == 0
catch
return 1
endtry
endfunction
func Test_catch_return_with_error()
call assert_equal(1, s:foo())
endfunc

View File

@ -268,6 +268,11 @@ func Test_tolower()
" Ⱥ (U+023A) and Ⱦ (U+023E) are the *only* code points to increase
" in length (2 to 3 bytes) when lowercased. So let's test them.
call assert_equal("ⱥ ⱦ", tolower("Ⱥ Ⱦ"))
" This call to tolower with invalid utf8 sequence used to cause access to
" invalid memory.
call tolower("\xC0\x80\xC0")
call tolower("123\xC0\x80\xC0")
endfunc
func Test_toupper()
@ -338,6 +343,11 @@ func Test_toupper()
call assert_equal("ZŹŻŽƵẐẔ", toupper("ZŹŻŽƵẐẔ"))
call assert_equal("Ⱥ Ⱦ", toupper("ⱥ ⱦ"))
" This call to toupper with invalid utf8 sequence used to cause access to
" invalid memory.
call toupper("\xC0\x80\xC0")
call toupper("123\xC0\x80\xC0")
endfunc
" Tests for the mode() function

View File

@ -3038,3 +3038,43 @@ func Test_lfile_crash()
call assert_fails('lfile', 'E40')
au! QuickFixCmdPre
endfunc
" The following test used to crash vim
func Test_lbuffer_crash()
sv Xtest
augroup QF_Test
au!
au * * bw
augroup END
lbuffer
augroup QF_Test
au!
augroup END
endfunc
" The following test used to crash vim
func Test_lexpr_crash()
augroup QF_Test
au!
au * * call setloclist(0, [], 'f')
augroup END
lexpr ""
augroup QF_Test
au!
augroup END
enew | only
endfunc
" The following test used to crash Vim
func Test_lvimgrep_crash()
sv Xtest
augroup QF_Test
au!
au * * call setloclist(0, [], 'f')
augroup END
lvimgrep quickfix test_quickfix.vim
augroup QF_Test
au!
augroup END
enew | only
endfunc

View File

@ -122,7 +122,12 @@ func Test_paused()
let slept = WaitFor('g:val == 1')
call assert_equal(1, g:val)
if has('reltime')
call assert_inrange(0, 30, slept)
if has('mac')
" The travis Mac machines appear to be very busy.
call assert_inrange(0, 40, slept)
else
call assert_inrange(0, 30, slept)
endif
else
call assert_inrange(0, 10, slept)
endif

View File

@ -206,3 +206,15 @@ func Test_CmdCompletion()
com! -complete=customlist,CustomComp DoCmd :
call assert_fails("call feedkeys(':DoCmd \<C-D>', 'tx')", 'E117:')
endfunc
func CallExecute(A, L, P)
" Drop first '\n'
return execute('echo "hi"')[1:]
endfunc
func Test_use_execute_in_completion()
command! -nargs=* -complete=custom,CallExecute DoExec :
call feedkeys(":DoExec \<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"DoExec hi', @:)
delcommand DoExec
endfunc

View File

@ -2972,6 +2972,9 @@ ex_return(exarg_T *eap)
/* It's safer to return also on error. */
else if (!eap->skip)
{
/* In return statement, cause_abort should be force_abort. */
update_force_abort();
/*
* Return unless the expression evaluation has been cancelled due to an
* aborting error, an interrupt, or an exception.

View File

@ -771,6 +771,18 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1425,
/**/
1424,
/**/
1423,
/**/
1422,
/**/
1421,
/**/
1420,
/**/
1419,
/**/