@@ -557,13 +557,13 @@ winbar.render = function (buffer, window)
557
557
return " " ;
558
558
end
559
559
560
- local swID = vim .w [window ].__scID ;
560
+ local wbID = vim .w [window ].__scID ;
561
561
562
- if not swID then
562
+ if not wbID then
563
563
return " " ;
564
564
end
565
565
566
- local config = winbar .config [swID ];
566
+ local config = winbar .config [wbID ];
567
567
568
568
if type (config ) ~= " table" then
569
569
return " " ;
@@ -594,11 +594,13 @@ winbar.detach = function (buffer)
594
594
local windows = vim .fn .win_findbuf (buffer )
595
595
596
596
for _ , win in ipairs (windows ) do
597
- winbar .state .attached_windows [win ] = false ;
598
- vim .wo [win ].winbar = vim .w [win ].__winbar and vim .w [win ].__winbar [1 ] or " " ;
597
+ vim .defer_fn (function ()
598
+ winbar .state .attached_windows [win ] = false ;
599
+ vim .wo [win ].winbar = vim .w [win ].__winbar and vim .w [win ].__winbar [1 ] or " " ;
599
600
600
- vim .w [win ].__swID = nil ;
601
- vim .w [win ].__winbar = nil ;
601
+ vim .w [win ].__wbID = nil ;
602
+ vim .w [win ].__winbar = nil ;
603
+ end , 0 );
602
604
end
603
605
604
606
--- | fE
@@ -646,13 +648,15 @@ winbar.attach = function (buffer)
646
648
goto continue ;
647
649
end
648
650
649
- local swID = winbar .update_id (win );
650
- winbar .state .attached_windows [win ] = true ;
651
+ vim .defer_fn (function ()
652
+ local wbID = winbar .update_id (win );
653
+ winbar .state .attached_windows [win ] = true ;
651
654
652
- vim .w [win ].__swID = swID ;
655
+ vim .w [win ].__wbID = wbID ;
653
656
654
- vim .w [win ].__winbar = utils .to_constant (vim .wo [win ].winbar );
655
- vim .wo [win ].winbar = " %!v:lua.require('bars.winbar').render(" .. buffer .. " ," .. win .. " )" ;
657
+ vim .w [win ].__winbar = utils .to_constant (vim .wo [win ].winbar );
658
+ vim .wo [win ].winbar = " %!v:lua.require('bars.winbar').render(" .. buffer .. " ," .. win .. " )" ;
659
+ end , 0 );
656
660
657
661
:: continue::
658
662
end
@@ -712,7 +716,7 @@ winbar.setup = function (config)
712
716
end
713
717
714
718
for window , _ in pairs (winbar .state .attached_windows ) do
715
- vim .w [window ].__swID = winbar .update_id (window );
719
+ vim .w [window ].__wbID = winbar .update_id (window );
716
720
end
717
721
end
718
722
0 commit comments