summaryrefslogtreecommitdiff
path: root/src/testdir/test_syntax.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-08-03 13:29:46 +0200
committerBram Moolenaar <Bram@vim.org>2019-08-03 13:29:46 +0200
commitc7f1e4002184903f4e12e429dd5c6ab731932f86 (patch)
treea101834cbba39badc74d3882e2f011218848c3bf /src/testdir/test_syntax.vim
parentf2d8b7a0a69fd71018341755da5ce55d067b5923 (diff)
downloadvim-git-c7f1e4002184903f4e12e429dd5c6ab731932f86.tar.gz
patch 8.1.1795: no syntax HL after splitting windows with :bufdov8.1.1795
Problem: No syntax HL after splitting windows with :bufdo. (Yasuhiro Matsumoto) Solution: Trigger Syntax autocommands in buffers that are active. (closes #4761)
Diffstat (limited to 'src/testdir/test_syntax.vim')
-rw-r--r--src/testdir/test_syntax.vim38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/testdir/test_syntax.vim b/src/testdir/test_syntax.vim
index c9808bec4..562a44ce1 100644
--- 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