0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

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)
This commit is contained in:
Bram Moolenaar
2019-08-03 13:29:46 +02:00
parent f2d8b7a0a6
commit c7f1e40021
5 changed files with 89 additions and 15 deletions

View File

@@ -1447,9 +1447,15 @@ ex_listdo(exarg_T *eap)
#if defined(FEAT_SYN_HL)
if (eap->cmdidx != CMD_windo && eap->cmdidx != CMD_tabdo)
{
/* Don't do syntax HL autocommands. Skipping the syntax file is a
* great speed improvement. */
save_ei = au_event_disable(",Syntax");
for (buf = firstbuf; buf != NULL; buf = buf->b_next)
buf->b_flags &= ~BF_SYN_SET;
buf = curbuf;
}
#endif
#ifdef FEAT_CLIPBOARD
start_global_changes();
@@ -1641,9 +1647,35 @@ ex_listdo(exarg_T *eap)
#if defined(FEAT_SYN_HL)
if (save_ei != NULL)
{
buf_T *bnext;
aco_save_T aco;
au_event_restore(save_ei);
apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn,
for (buf = firstbuf; buf != NULL; buf = bnext)
{
bnext = buf->b_next;
if (buf->b_nwindows > 0 && (buf->b_flags & BF_SYN_SET))
{
buf->b_flags &= ~BF_SYN_SET;
// buffer was opened while Syntax autocommands were disabled,
// need to trigger them now.
if (buf == curbuf)
apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn,
curbuf->b_fname, TRUE, curbuf);
else
{
aucmd_prepbuf(&aco, buf);
apply_autocmds(EVENT_SYNTAX, buf->b_p_syn,
buf->b_fname, TRUE, buf);
aucmd_restbuf(&aco);
}
// start over, in case autocommands messed things up.
bnext = firstbuf;
}
}
}
#endif
#ifdef FEAT_CLIPBOARD