comparison src/testdir/test_autocmd.vim @ 18619:788d76db02ac v8.1.2302

patch 8.1.2302: :lockmarks does not work for '[ and '] Commit: https://github.com/vim/vim/commit/f4a1d1c0542df151bc59ac3b798ed198b5c71ccc Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 16 13:50:25 2019 +0100 patch 8.1.2302: :lockmarks does not work for '[ and '] Problem: :lockmarks does not work for '[ and ']. Solution: save and restore '[ and '] marks. (James McCoy, closes https://github.com/vim/vim/issues/5222)
author Bram Moolenaar <Bram@vim.org>
date Sat, 16 Nov 2019 14:00:05 +0100
parents 75c466dcf61c
children 068337e86133
comparison
equal deleted inserted replaced
18618:74422854344d 18619:788d76db02ac
2295 n x 2295 n x
2296 au WinEnter * quit 2296 au WinEnter * quit
2297 split 2297 split
2298 au! WinEnter 2298 au! WinEnter
2299 endfunc 2299 endfunc
2300
2301 func Test_BufWrite_lockmarks()
2302 edit! Xtest
2303 call setline(1, ['a', 'b', 'c', 'd'])
2304
2305 " :lockmarks preserves the marks
2306 call SetChangeMarks(2, 3)
2307 lockmarks write
2308 call assert_equal([2, 3], [line("'["), line("']")])
2309
2310 " *WritePre autocmds get the correct line range, but lockmarks preserves the
2311 " original values for the user
2312 augroup lockmarks
2313 au!
2314 au BufWritePre,FilterWritePre * call assert_equal([1, 4], [line("'["), line("']")])
2315 au FileWritePre * call assert_equal([3, 4], [line("'["), line("']")])
2316 augroup END
2317
2318 lockmarks write
2319 call assert_equal([2, 3], [line("'["), line("']")])
2320
2321 if executable('cat')
2322 lockmarks %!cat
2323 call assert_equal([2, 3], [line("'["), line("']")])
2324 endif
2325
2326 lockmarks 3,4write Xtest2
2327 call assert_equal([2, 3], [line("'["), line("']")])
2328
2329 au! lockmarks
2330 augroup! lockmarks
2331 call delete('Xtest')
2332 call delete('Xtest2')
2333 endfunc