mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
Merge #10028 from janlazo/vim-8.1.1345
vim-patch:8.1.{1325,1345,1348,1349}
This commit is contained in:
@@ -3819,7 +3819,6 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
|
|||||||
if (!preview || has_second_delim) {
|
if (!preview || has_second_delim) {
|
||||||
if (subflags.do_count) {
|
if (subflags.do_count) {
|
||||||
// prevent accidentally changing the buffer by a function
|
// prevent accidentally changing the buffer by a function
|
||||||
save_ma = curbuf->b_p_ma;
|
|
||||||
curbuf->b_p_ma = false;
|
curbuf->b_p_ma = false;
|
||||||
sandbox++;
|
sandbox++;
|
||||||
}
|
}
|
||||||
@@ -3832,13 +3831,9 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
|
|||||||
sub, sub_firstline, false, p_magic, true);
|
sub, sub_firstline, false, p_magic, true);
|
||||||
// If getting the substitute string caused an error, don't do
|
// If getting the substitute string caused an error, don't do
|
||||||
// the replacement.
|
// the replacement.
|
||||||
if (aborting()) {
|
|
||||||
goto skip;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't keep flags set by a recursive call
|
// Don't keep flags set by a recursive call
|
||||||
subflags = subflags_save;
|
subflags = subflags_save;
|
||||||
if (subflags.do_count) {
|
if (aborting() || subflags.do_count) {
|
||||||
curbuf->b_p_ma = save_ma;
|
curbuf->b_p_ma = save_ma;
|
||||||
if (sandbox > 0) {
|
if (sandbox > 0) {
|
||||||
sandbox--;
|
sandbox--;
|
||||||
|
@@ -3693,9 +3693,11 @@ restore_backup:
|
|||||||
/*
|
/*
|
||||||
* Remove the backup unless 'backup' option is set
|
* Remove the backup unless 'backup' option is set
|
||||||
*/
|
*/
|
||||||
if (!p_bk && backup != NULL && os_remove((char *)backup) != 0)
|
if (!p_bk && backup != NULL
|
||||||
|
&& !write_info.bw_conv_error
|
||||||
|
&& os_remove((char *)backup) != 0) {
|
||||||
EMSG(_("E207: Can't delete backup file"));
|
EMSG(_("E207: Can't delete backup file"));
|
||||||
|
}
|
||||||
|
|
||||||
goto nofail;
|
goto nofail;
|
||||||
|
|
||||||
|
@@ -72,7 +72,31 @@ if has('timers')
|
|||||||
au! CursorHoldI
|
au! CursorHoldI
|
||||||
set updatetime&
|
set updatetime&
|
||||||
endfunc
|
endfunc
|
||||||
endif
|
|
||||||
|
func Test_OptionSet_modeline()
|
||||||
|
throw 'skipped: Nvim does not support test_override()'
|
||||||
|
call test_override('starting', 1)
|
||||||
|
au! OptionSet
|
||||||
|
augroup set_tabstop
|
||||||
|
au OptionSet tabstop call timer_start(1, {-> execute("echo 'Handler called'", "")})
|
||||||
|
augroup END
|
||||||
|
call writefile(['vim: set ts=7 sw=5 :', 'something'], 'XoptionsetModeline')
|
||||||
|
set modeline
|
||||||
|
let v:errmsg = ''
|
||||||
|
call assert_fails('split XoptionsetModeline', 'E12:')
|
||||||
|
call assert_equal(7, &ts)
|
||||||
|
call assert_equal('', v:errmsg)
|
||||||
|
|
||||||
|
augroup set_tabstop
|
||||||
|
au!
|
||||||
|
augroup END
|
||||||
|
bwipe!
|
||||||
|
set ts&
|
||||||
|
call delete('XoptionsetModeline')
|
||||||
|
call test_override('starting', 0)
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
endif "has('timers')
|
||||||
|
|
||||||
func Test_bufunload()
|
func Test_bufunload()
|
||||||
augroup test_bufunload_group
|
augroup test_bufunload_group
|
||||||
@@ -677,29 +701,6 @@ func Test_OptionSet_diffmode_close()
|
|||||||
"delfunc! AutoCommandOptionSet
|
"delfunc! AutoCommandOptionSet
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_OptionSet_modeline()
|
|
||||||
throw 'skipped: Nvim does not support test_override()'
|
|
||||||
call test_override('starting', 1)
|
|
||||||
au! OptionSet
|
|
||||||
augroup set_tabstop
|
|
||||||
au OptionSet tabstop call timer_start(1, {-> execute("echo 'Handler called'", "")})
|
|
||||||
augroup END
|
|
||||||
call writefile(['vim: set ts=7 sw=5 :', 'something'], 'XoptionsetModeline')
|
|
||||||
set modeline
|
|
||||||
let v:errmsg = ''
|
|
||||||
call assert_fails('split XoptionsetModeline', 'E12:')
|
|
||||||
call assert_equal(7, &ts)
|
|
||||||
call assert_equal('', v:errmsg)
|
|
||||||
|
|
||||||
augroup set_tabstop
|
|
||||||
au!
|
|
||||||
augroup END
|
|
||||||
bwipe!
|
|
||||||
set ts&
|
|
||||||
call delete('XoptionsetModeline')
|
|
||||||
call test_override('starting', 0)
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
" Test for Bufleave autocommand that deletes the buffer we are about to edit.
|
" Test for Bufleave autocommand that deletes the buffer we are about to edit.
|
||||||
func Test_BufleaveWithDelete()
|
func Test_BufleaveWithDelete()
|
||||||
new | edit Xfile1
|
new | edit Xfile1
|
||||||
|
@@ -1385,9 +1385,26 @@ func Test_edit_complete_very_long_name()
|
|||||||
return
|
return
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
" Try to get the Vim window position before setting 'columns'.
|
" Try to get the Vim window position before setting 'columns', so that we can
|
||||||
|
" move the window back to where it was.
|
||||||
let winposx = getwinposx()
|
let winposx = getwinposx()
|
||||||
let winposy = getwinposy()
|
let winposy = getwinposy()
|
||||||
|
|
||||||
|
if winposx >= 0 && winposy >= 0 && !has('gui_running')
|
||||||
|
" We did get the window position, but xterm may report the wrong numbers.
|
||||||
|
" Move the window to the reported position and compute any offset.
|
||||||
|
exe 'winpos ' . winposx . ' ' . winposy
|
||||||
|
sleep 100m
|
||||||
|
let x = getwinposx()
|
||||||
|
if x >= 0
|
||||||
|
let winposx += winposx - x
|
||||||
|
endif
|
||||||
|
let y = getwinposy()
|
||||||
|
if y >= 0
|
||||||
|
let winposy += winposy - y
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
let save_columns = &columns
|
let save_columns = &columns
|
||||||
" Need at least about 1100 columns to reproduce the problem.
|
" Need at least about 1100 columns to reproduce the problem.
|
||||||
set columns=2000
|
set columns=2000
|
||||||
|
@@ -639,6 +639,17 @@ func Test_nocatch_sub_failure_handling()
|
|||||||
call assert_equal(1, error_caught)
|
call assert_equal(1, error_caught)
|
||||||
call assert_equal(['1 aaa', '2 aaa', '3 aaa'], getline(1, 3))
|
call assert_equal(['1 aaa', '2 aaa', '3 aaa'], getline(1, 3))
|
||||||
|
|
||||||
|
" Same, but using "n" flag so that "sandbox" gets set
|
||||||
|
call setline(1, ['1 aaa', '2 aaa', '3 aaa'])
|
||||||
|
let error_caught = 0
|
||||||
|
try
|
||||||
|
%s/aaa/\=Foo()/gn
|
||||||
|
catch
|
||||||
|
let error_caught = 1
|
||||||
|
endtry
|
||||||
|
call assert_equal(1, error_caught)
|
||||||
|
call assert_equal(['1 aaa', '2 aaa', '3 aaa'], getline(1, 3))
|
||||||
|
|
||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@@ -36,13 +36,15 @@ func Test_writefile_fails_conversion()
|
|||||||
if !has('multi_byte') || !has('iconv')
|
if !has('multi_byte') || !has('iconv')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
" Without a backup file the write won't happen if there is a conversion
|
||||||
|
" error.
|
||||||
set nobackup nowritebackup
|
set nobackup nowritebackup
|
||||||
new
|
new
|
||||||
let contents = ["line one", "line two"]
|
let contents = ["line one", "line two"]
|
||||||
call writefile(contents, 'Xfile')
|
call writefile(contents, 'Xfile')
|
||||||
edit Xfile
|
edit Xfile
|
||||||
call setline(1, ["first line", "cannot convert \u010b", "third line"])
|
call setline(1, ["first line", "cannot convert \u010b", "third line"])
|
||||||
call assert_fails('write ++enc=cp932')
|
call assert_fails('write ++enc=cp932', 'E513:')
|
||||||
call assert_equal(contents, readfile('Xfile'))
|
call assert_equal(contents, readfile('Xfile'))
|
||||||
|
|
||||||
call delete('Xfile')
|
call delete('Xfile')
|
||||||
@@ -50,6 +52,27 @@ func Test_writefile_fails_conversion()
|
|||||||
set backup& writebackup&
|
set backup& writebackup&
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_writefile_fails_conversion2()
|
||||||
|
if !has('iconv') || has('sun')
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
" With a backup file the write happens even if there is a conversion error,
|
||||||
|
" but then the backup file must remain
|
||||||
|
set nobackup writebackup
|
||||||
|
let contents = ["line one", "line two"]
|
||||||
|
call writefile(contents, 'Xfile_conversion_err')
|
||||||
|
edit Xfile_conversion_err
|
||||||
|
call setline(1, ["first line", "cannot convert \u010b", "third line"])
|
||||||
|
set fileencoding=latin1
|
||||||
|
let output = execute('write')
|
||||||
|
call assert_match('CONVERSION ERROR', output)
|
||||||
|
call assert_equal(contents, readfile('Xfile_conversion_err~'))
|
||||||
|
|
||||||
|
call delete('Xfile_conversion_err')
|
||||||
|
call delete('Xfile_conversion_err~')
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
func SetFlag(timer)
|
func SetFlag(timer)
|
||||||
let g:flag = 1
|
let g:flag = 1
|
||||||
endfunc
|
endfunc
|
||||||
|
Reference in New Issue
Block a user