Merge #6372 from lonerover/vim-7.4.2307

This commit is contained in:
Justin M. Keyes 2017-03-27 13:16:17 +02:00 committed by GitHub
commit 2b1398c31e
6 changed files with 134 additions and 6 deletions

View File

@ -627,10 +627,11 @@ void buf_freeall(buf_T *buf, int flags)
*/
if (buf == curbuf && !is_curbuf)
return;
diff_buf_delete(buf); /* Can't use 'diff' for unloaded buffer. */
/* Remove any ownsyntax, unless exiting. */
if (firstwin != NULL && curwin->w_buffer == buf)
diff_buf_delete(buf); // Can't use 'diff' for unloaded buffer.
// Remove any ownsyntax, unless exiting.
if (curwin != NULL && curwin->w_buffer == buf) {
reset_synblock(curwin);
}
/* No folds in an empty buffer. */
FOR_ALL_TAB_WINDOWS(tp, win) {

View File

@ -30,6 +30,7 @@ SCRIPTS ?= \
NEW_TESTS ?= \
test_autocmd.res \
test_bufwintabinfo.res \
test_charsearch.res \
test_cmdline.res \
test_command_count.res \
test_cscope.res \
@ -37,6 +38,7 @@ NEW_TESTS ?= \
test_diffmode.res \
test_farsi.res \
test_filter_map.res \
test_fnameescape.res \
test_fold.res \
test_glob2regpat.res \
test_gn.res \
@ -55,6 +57,7 @@ NEW_TESTS ?= \
test_normal.res \
test_quickfix.res \
test_signs.res \
test_substitute.res \
test_syntax.res \
test_tabpage.res \
test_textobjects.res \

View File

@ -0,0 +1,62 @@
function! Test_charsearch()
enew!
call append(0, ['Xabcdefghijkemnopqretuvwxyz',
\ 'Yabcdefghijkemnopqretuvwxyz',
\ 'Zabcdefghijkemnokqretkvwxyz'])
" check that "fe" and ";" work
1
normal! ylfep;;p,,p
call assert_equal('XabcdeXfghijkeXmnopqreXtuvwxyz', getline(1))
" check that save/restore works
2
normal! ylfep
let csave = getcharsearch()
normal! fip
call setcharsearch(csave)
normal! ;p;p
call assert_equal('YabcdeYfghiYjkeYmnopqreYtuvwxyz', getline(2))
" check that setcharsearch() changes the settings.
3
normal! ylfep
call setcharsearch({'char': 'k'})
normal! ;p
call setcharsearch({'forward': 0})
normal! $;p
call setcharsearch({'until': 1})
set cpo-=;
normal! ;;p
call assert_equal('ZabcdeZfghijkZZemnokqretkZvwxyz', getline(3))
enew!
endfunction
" Test for t,f,F,T movement commands and 'cpo-;' setting
function! Test_search_cmds()
enew!
call append(0, ["aaa two three four", " zzz", "yyy ",
\ "bbb yee yoo four", "ccc two three four",
\ "ddd yee yoo four"])
set cpo-=;
1
normal! 0tt;D
2
normal! 0fz;D
3
normal! $Fy;D
4
normal! $Ty;D
set cpo+=;
5
normal! 0tt;;D
6
normal! $Ty;;D
call assert_equal('aaa two', getline(1))
call assert_equal(' z', getline(2))
call assert_equal('y', getline(3))
call assert_equal('bbb y', getline(4))
call assert_equal('ccc', getline(5))
call assert_equal('ddd yee y', getline(6))
enew!
endfunction

View File

@ -0,0 +1,21 @@
" Test if fnameescape is correct for special chars like !
function! Test_fnameescape()
let fname = 'Xspa ce'
let status = v:false
try
exe "w! " . fnameescape(fname)
let status = v:true
endtry
call assert_true(status, "Space")
call delete(fname)
let fname = 'Xemark!'
let status = v:false
try
exe "w! " . fnameescape(fname)
let status = v:true
endtry
call assert_true(status, "ExclamationMark")
call delete(fname)
endfunction

View File

@ -0,0 +1,41 @@
" Tests for multi-line regexps with ":s".
function! Test_multiline_subst()
enew!
call append(0, ["1 aa",
\ "bb",
\ "cc",
\ "2 dd",
\ "ee",
\ "3 ef",
\ "gh",
\ "4 ij",
\ "5 a8",
\ "8b c9",
\ "9d",
\ "6 e7",
\ "77f",
\ "xxxxx"])
1
" test if replacing a line break works with a back reference
/^1/,/^2/s/\n\(.\)/ \1/
" test if inserting a line break works with a back reference
/^3/,/^4/s/\(.\)$/\r\1/
" test if replacing a line break with another line break works
/^5/,/^6/s/\(\_d\{3}\)/x\1x/
call assert_equal('1 aa bb cc 2 dd ee', getline(1))
call assert_equal('3 e', getline(2))
call assert_equal('f', getline(3))
call assert_equal('g', getline(4))
call assert_equal('h', getline(5))
call assert_equal('4 i', getline(6))
call assert_equal('j', getline(7))
call assert_equal('5 ax8', getline(8))
call assert_equal('8xb cx9', getline(9))
call assert_equal('9xd', getline(10))
call assert_equal('6 ex7', getline(11))
call assert_equal('7x7f', getline(12))
call assert_equal('xxxxx', getline(13))
enew!
endfunction

View File

@ -107,11 +107,11 @@ static int included_patches[] = {
2337,
2336,
2335,
// 2334,
2334,
2333,
// 2332 NA
2331,
// 2330,
2330,
2329,
2328,
// 2327 NA
@ -134,7 +134,7 @@ static int included_patches[] = {
// 2310 NA
2309,
// 2308 NA
// 2307,
2307,
// 2306,
2305,
// 2304 NA