Mercurial > vim
diff src/testdir/test_syntax.vim @ 17596:892b4ea3bad6 v8.1.1795
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
commit https://github.com/vim/vim/commit/c7f1e4002184903f4e12e429dd5c6ab731932f86
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 3 13:29:46 2019 +0200
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Problem: No syntax HL after splitting windows with :bufdo. (Yasuhiro
Matsumoto)
Solution: Trigger Syntax autocommands in buffers that are active.
(closes #4761)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 03 Aug 2019 13:30:07 +0200 |
parents | 8e9e9124c7a2 |
children | 4c7097a980a5 |
line wrap: on
line diff
--- a/src/testdir/test_syntax.vim +++ b/src/testdir/test_syntax.vim @@ -582,3 +582,41 @@ func Test_syn_wrong_z_one() call test_override("ALL", 0) bwipe! endfunc + +func Test_syntax_after_bufdo() + call writefile(['/* aaa comment */'], 'Xaaa.c') + call writefile(['/* bbb comment */'], 'Xbbb.c') + call writefile(['/* ccc comment */'], 'Xccc.c') + call writefile(['/* ddd comment */'], 'Xddd.c') + + let bnr = bufnr('%') + new Xaaa.c + badd Xbbb.c + badd Xccc.c + badd Xddd.c + exe "bwipe " . bnr + let l = [] + bufdo call add(l, bufnr('%')) + call assert_equal(4, len(l)) + + syntax on + + " This used to only enable syntax HL in the last buffer. + bufdo tab split + tabrewind + for tab in range(1, 4) + norm fm + call assert_equal(['cComment'], map(synstack(line("."), col(".")), 'synIDattr(v:val, "name")')) + tabnext + endfor + + bwipe! Xaaa.c + bwipe! Xbbb.c + bwipe! Xccc.c + bwipe! Xddd.c + syntax off + call delete('Xaaa.c') + call delete('Xbbb.c') + call delete('Xccc.c') + call delete('Xddd.c') +endfunc