Merge #12203 from janlazo/vim-8.2.0648

vim-patch:8.1.{800,868,1581},8.2.{648,649,663,678,681,688,691,692}
This commit is contained in:
Justin M. Keyes 2020-05-05 23:38:15 -04:00 committed by GitHub
commit f04a9a2c9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 105 additions and 36 deletions

View File

@ -6516,9 +6516,11 @@ A jump table for the options with a short description can be found at |Q_op|.
>= 1 When the shada file is read or written.
>= 2 When a file is ":source"'ed.
>= 3 UI info, terminal capabilities
>= 4 Shell commands.
>= 5 Every searched tags file and include file.
>= 8 Files for which a group of autocommands is executed.
>= 9 Every executed autocommand.
>= 11 Finding items in a path
>= 12 Every executed function.
>= 13 When an exception is thrown, caught, finished, or discarded.
>= 14 Anything pending in a ":finally" clause.

View File

@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2020 Apr 12
" Last Change: 2020 Apr 29
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
@ -1646,7 +1646,9 @@ au BufNewFile,BufRead */etc/systemd/system/*.d/*.conf setf systemd
au BufNewFile,BufRead */.config/systemd/user/*.d/*.conf setf systemd
" Systemd temp files
au BufNewFile,BufRead */etc/systemd/system/*.d/.#* setf systemd
au BufNewFile,BufRead */etc/systemd/system/.#* setf systemd
au BufNewFile,BufRead */.config/systemd/user/*.d/.#* setf systemd
au BufNewFile,BufRead */.config/systemd/user/.#* setf systemd
" Synopsys Design Constraints
au BufNewFile,BufRead *.sdc setf sdc

View File

@ -9129,7 +9129,8 @@ static int ins_apply_autocmds(event_T event)
// If u_savesub() was called then we are not prepared to start
// a new line. Call u_save() with no contents to fix that.
if (tick != buf_get_changedtick(curbuf)) {
// Except when leaving Insert mode.
if (event != EVENT_INSERTLEAVE && tick != buf_get_changedtick(curbuf)) {
u_save(curwin->w_cursor.lnum, (linenr_T)(curwin->w_cursor.lnum + 1));
}

View File

@ -592,6 +592,8 @@ static void cleanup_function_call(funccall_T *fc)
if (!fc_referenced(fc)) {
free_funccal(fc, false);
} else {
static int made_copy = 0;
// "fc" is still in use. This can happen when returning "a:000",
// assigning "l:" to a global variable or defining a closure.
// Link "fc" in the list for garbage collection later.
@ -607,6 +609,15 @@ static void cleanup_function_call(funccall_T *fc)
TV_LIST_ITER(&fc->l_varlist, li, {
tv_copy(TV_LIST_ITEM_TV(li), TV_LIST_ITEM_TV(li));
});
if (++made_copy == 10000) {
// We have made a lot of copies. This can happen when
// repetitively calling a function that creates a reference to
// itself somehow. Call the garbage collector soon to avoid using
// too much memory.
made_copy = 0;
want_garbage_collect = true;
}
}
}

View File

@ -2394,7 +2394,7 @@ int do_in_path(char_u *path, char_u *name, int flags,
char_u *rtp_copy = vim_strsave(path);
char_u *buf = xmallocz(MAXPATHL);
{
if (p_verbose > 1 && name != NULL) {
if (p_verbose > 10 && name != NULL) {
verbose_enter();
smsg(_("Searching for \"%s\" in \"%s\""),
(char *)name, (char *)path);
@ -2436,7 +2436,7 @@ int do_in_path(char_u *path, char_u *name, int flags,
copy_option_part(&np, tail, (size_t)(MAXPATHL - (tail - buf)),
"\t ");
if (p_verbose > 2) {
if (p_verbose > 10) {
verbose_enter();
smsg(_("Searching for \"%s\""), buf);
verbose_leave();

View File

@ -2476,8 +2476,11 @@ int parse_cmd_address(exarg_T *eap, char_u **errormsg)
if (*eap->cmd == ';') {
if (!eap->skip) {
curwin->w_cursor.lnum = eap->line2;
// don't leave the cursor on an illegal line or column
check_cursor();
// Don't leave the cursor on an illegal line or column, but do
// accept zero as address, so 0;/PATTERN/ works correctly.
if (eap->line2 > 0) {
check_cursor();
}
}
} else if (*eap->cmd != ',') {
break;

View File

@ -63,9 +63,12 @@ static void pum_compute_size(void)
pum_kind_width = 0;
pum_extra_width = 0;
for (int i = 0; i < pum_size; i++) {
int w = vim_strsize(pum_array[i].pum_text);
if (pum_base_width < w) {
pum_base_width = w;
int w;
if (pum_array[i].pum_text != NULL) {
w = vim_strsize(pum_array[i].pum_text);
if (pum_base_width < w) {
pum_base_width = w;
}
}
if (pum_array[i].pum_kind != NULL) {
w = vim_strsize(pum_array[i].pum_kind) + 1;

View File

@ -5714,6 +5714,7 @@ void grid_puts_line_flush(bool set_cursor)
static void start_search_hl(void)
{
if (p_hls && !no_hlsearch) {
end_search_hl(); // just in case it wasn't called before
last_pat_prog(&search_hl.rm);
// Set the time limit to 'redrawtime'.
search_hl.tm = profile_setlimit(p_rdt);

View File

@ -98,11 +98,6 @@ func GetAllocId(name)
return lnum - top - 1
endfunc
func CanRunVimInTerminal()
" Nvim: always false, we use Lua screen-tests instead.
return 0
endfunc
func RunTheTest(test)
echo 'Executing ' . a:test

View File

@ -0,0 +1,2 @@
source shared.vim
source term_util.vim

View File

@ -1,10 +1,12 @@
" Functions shared by several tests.
" Only load this script once.
if exists('*WaitFor')
if exists('*PythonProg')
finish
endif
source view_util.vim
" {Nvim}
" Filepath captured from output may be truncated, like this:
" /home/va...estdir/Xtest-tmpdir/nvimxbXN4i/10
@ -328,17 +330,6 @@ func RunVimPiped(before, after, arguments, pipecmd)
return 1
endfunc
" Get line "lnum" as displayed on the screen.
" Trailing white space is trimmed.
func! Screenline(lnum)
let chars = []
for c in range(1, winwidth(0))
call add(chars, nr2char(screenchar(a:lnum, c)))
endfor
let line = join(chars, '')
return matchstr(line, '^.\{-}\ze\s*$')
endfunc
func CanRunGui()
return has('gui') && ($DISPLAY != "" || has('gui_running'))
endfunc

View File

@ -0,0 +1,11 @@
" Functions about terminal shared by several tests
" Only load this script once.
if exists('*CanRunVimInTerminal')
finish
endif
func CanRunVimInTerminal()
" Nvim: always false, we use Lua screen-tests instead.
return 0
endfunc

View File

@ -1,7 +1,7 @@
" Tests for setbufline(), getbufline(), appendbufline(), deletebufline()
source shared.vim
" source screendump.vim
source screendump.vim
func Test_setbufline_getbufline()
new

View File

@ -801,3 +801,16 @@ func Test_buffers_lastused()
bwipeout bufb
bwipeout bufc
endfunc
" test that ";" works to find a match at the start of the first line
func Test_zero_line_search()
new
call setline(1, ["1, pattern", "2, ", "3, pattern"])
call cursor(1,1)
0;/pattern/d
call assert_equal(["2, ", "3, pattern"], getline(1,'$'))
q!
endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@ -1,7 +1,7 @@
" Tests for the Vim script debug commands
source shared.vim
" source screendump.vim
source screendump.vim
" Run a Vim debugger command
" If the expected output argument is supplied, then check for it.

View File

@ -1,4 +1,6 @@
" Tests for diff mode
source shared.vim
source screendump.vim
func Test_diff_fold_sync()
enew!

View File

@ -1439,7 +1439,7 @@ func Test_edit_alt()
call delete('XAltFile')
endfunc
func Test_leave_insert_autocmd()
func Test_edit_InsertLeave()
new
au InsertLeave * let g:did_au = 1
let g:did_au = 0
@ -1469,6 +1469,21 @@ func Test_leave_insert_autocmd()
iunmap x
endfunc
func Test_edit_InsertLeave_undo()
new XtestUndo
set undofile
au InsertLeave * wall
exe "normal ofoo\<Esc>"
call assert_equal(2, line('$'))
normal u
call assert_equal(1, line('$'))
bwipe!
au! InsertLeave
call delete('XtestUndo')
set undofile&
endfunc
" Test for inserting characters using CTRL-V followed by a number.
func Test_edit_special_chars()
new

View File

@ -437,7 +437,7 @@ let s:filename_checks = {
\ 'swiftgyb': ['file.swift.gyb'],
\ 'sil': ['file.sil'],
\ 'sysctl': ['/etc/sysctl.conf', '/etc/sysctl.d/file.conf'],
\ 'systemd': ['any/systemd/file.automount', 'any/systemd/file.mount', 'any/systemd/file.path', 'any/systemd/file.service', 'any/systemd/file.socket', 'any/systemd/file.swap', 'any/systemd/file.target', 'any/systemd/file.timer', '/etc/systemd/system/some.d/file.conf', '/etc/systemd/system/some.d/.#file', '/home/user/.config/systemd/user/some.d/mine.conf', '/home/user/.config/systemd/user/some.d/.#file'],
\ 'systemd': ['any/systemd/file.automount', 'any/systemd/file.mount', 'any/systemd/file.path', 'any/systemd/file.service', 'any/systemd/file.socket', 'any/systemd/file.swap', 'any/systemd/file.target', 'any/systemd/file.timer', '/etc/systemd/system/some.d/file.conf', '/etc/systemd/system/some.d/.#file', '/etc/systemd/system/.#otherfile', '/home/user/.config/systemd/user/some.d/mine.conf', '/home/user/.config/systemd/user/some.d/.#file', '/home/user/.config/systemd/user/.#otherfile'],
\ 'systemverilog': ['file.sv', 'file.svh'],
\ 'tags': ['tags'],
\ 'tak': ['file.tak'],

View File

@ -1,6 +1,7 @@
" Test for folding
source view_util.vim
source screendump.vim
func PrepIndent(arg)
return [a:arg] + repeat(["\t".a:arg], 5)

View File

@ -1,6 +1,7 @@
" Tests for ":highlight" and highlighting.
source view_util.vim
source screendump.vim
func Test_highlight()
" basic test if ":highlight" doesn't crash

View File

@ -6,6 +6,9 @@ if !has('mksession')
finish
endif
source shared.vim
source term_util.vim
func Test_mksession()
tabnew
let wrap_save = &wrap

View File

@ -271,7 +271,7 @@ func Test_V_arg()
call assert_equal(" verbose=0\n", out)
let out = system(GetVimCommand() . ' --clean -es -X -V2 -c "set verbose?" -cq')
" call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\r\nSearching for \"filetype\.vim\".*\n", out)
" call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\r\nline \\d\\+: sourcing \"[^\"]*runtime[\\/]filetype\.vim\".*\n", out)
call assert_match(" verbose=2\n", out)
let out = system(GetVimCommand() . ' --clean -es -X -V15 -c "set verbose?" -cq')

View File

@ -1,7 +1,7 @@
" Tests for startup using utf-8.
source shared.vim
" source screendump.vim
source screendump.vim
func Test_read_stdin_utf8()
let linesin = ['テスト', '€ÀÈÌÒÙ']

View File

@ -1,6 +1,7 @@
" Test :suspend
source shared.vim
source term_util.vim
func CheckSuspended(buf, fileExists)
call WaitForAssert({-> assert_match('[$#] $', term_getline(a:buf, '.'))})
@ -55,7 +56,7 @@ func Test_suspend()
call term_wait(buf)
" Wait until Vim actually exited and shell shows a prompt
call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))})
call Stop_shell_in_terminal(buf)
call StopShellInTerminal(buf)
exe buf . 'bwipe!'
call delete('Xfoo')

View File

@ -1,6 +1,6 @@
" Tests for tabpage
" source screendump.vim
source screendump.vim
function Test_tabpage()
bw!

View File

@ -5,7 +5,7 @@ if !has('timers')
endif
source shared.vim
source screendump.vim
source term_util.vim
source load.vim
func MyHandler(timer)

View File

@ -1,10 +1,21 @@
" Functions about view shared by several tests
" Only load this script once.
if exists('*ScreenLines')
if exists('*Screenline')
finish
endif
" Get line "lnum" as displayed on the screen.
" Trailing white space is trimmed.
func Screenline(lnum)
let chars = []
for c in range(1, winwidth(0))
call add(chars, nr2char(screenchar(a:lnum, c)))
endfor
let line = join(chars, '')
return matchstr(line, '^.\{-}\ze\s*$')
endfunc
" ScreenLines(lnum, width) or
" ScreenLines([start, end], width)
function! ScreenLines(lnum, width) abort