comparison src/ex_cmds2.c @ 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 8f44c630c366
children ff097edaae89
comparison
equal deleted inserted replaced
17595:50cc81726702 17596:892b4ea3bad6
1445 } 1445 }
1446 #endif 1446 #endif
1447 1447
1448 #if defined(FEAT_SYN_HL) 1448 #if defined(FEAT_SYN_HL)
1449 if (eap->cmdidx != CMD_windo && eap->cmdidx != CMD_tabdo) 1449 if (eap->cmdidx != CMD_windo && eap->cmdidx != CMD_tabdo)
1450 {
1450 /* Don't do syntax HL autocommands. Skipping the syntax file is a 1451 /* Don't do syntax HL autocommands. Skipping the syntax file is a
1451 * great speed improvement. */ 1452 * great speed improvement. */
1452 save_ei = au_event_disable(",Syntax"); 1453 save_ei = au_event_disable(",Syntax");
1454
1455 for (buf = firstbuf; buf != NULL; buf = buf->b_next)
1456 buf->b_flags &= ~BF_SYN_SET;
1457 buf = curbuf;
1458 }
1453 #endif 1459 #endif
1454 #ifdef FEAT_CLIPBOARD 1460 #ifdef FEAT_CLIPBOARD
1455 start_global_changes(); 1461 start_global_changes();
1456 #endif 1462 #endif
1457 1463
1639 } 1645 }
1640 1646
1641 #if defined(FEAT_SYN_HL) 1647 #if defined(FEAT_SYN_HL)
1642 if (save_ei != NULL) 1648 if (save_ei != NULL)
1643 { 1649 {
1650 buf_T *bnext;
1651 aco_save_T aco;
1652
1644 au_event_restore(save_ei); 1653 au_event_restore(save_ei);
1645 apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn, 1654
1655 for (buf = firstbuf; buf != NULL; buf = bnext)
1656 {
1657 bnext = buf->b_next;
1658 if (buf->b_nwindows > 0 && (buf->b_flags & BF_SYN_SET))
1659 {
1660 buf->b_flags &= ~BF_SYN_SET;
1661
1662 // buffer was opened while Syntax autocommands were disabled,
1663 // need to trigger them now.
1664 if (buf == curbuf)
1665 apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn,
1646 curbuf->b_fname, TRUE, curbuf); 1666 curbuf->b_fname, TRUE, curbuf);
1667 else
1668 {
1669 aucmd_prepbuf(&aco, buf);
1670 apply_autocmds(EVENT_SYNTAX, buf->b_p_syn,
1671 buf->b_fname, TRUE, buf);
1672 aucmd_restbuf(&aco);
1673 }
1674
1675 // start over, in case autocommands messed things up.
1676 bnext = firstbuf;
1677 }
1678 }
1647 } 1679 }
1648 #endif 1680 #endif
1649 #ifdef FEAT_CLIPBOARD 1681 #ifdef FEAT_CLIPBOARD
1650 end_global_changes(); 1682 end_global_changes();
1651 #endif 1683 #endif