@@ -238,7 +238,7 @@ statuscolumn.detach = function (buffer)
238
238
vim .wo [win ].statuscolumn = vim .w [win ].__statuscolumn [1 ];
239
239
vim .w [win ].__statuscolumn = nil ;
240
240
else
241
- vim .wo [win ].statuscolumn = " " ;
241
+ vim .wo [win ].statuscolumn = " " ;
242
242
end
243
243
244
244
vim .w [win ].__scID = nil ;
@@ -290,16 +290,18 @@ statuscolumn.attach = function (buffer)
290
290
goto continue ;
291
291
end
292
292
293
- local scID = statuscolumn .update_id (win );
294
- statuscolumn .state .attached_windows [win ] = true ;
293
+ vim .defer_fn (function ()
294
+ local scID = statuscolumn .update_id (win );
295
+ statuscolumn .state .attached_windows [win ] = true ;
295
296
296
- vim .w [win ].__scID = scID ;
297
+ vim .w [win ].__scID = scID ;
297
298
298
- vim .w [win ].__numberwidth = utils .to_constant (vim .wo [win ].numberwidth );
299
- vim .w [win ].__statuscolumn = utils .to_constant (vim .wo [win ].statuscolumn );
299
+ vim .w [win ].__numberwidth = utils .to_constant (vim .wo [win ].numberwidth );
300
+ vim .w [win ].__statuscolumn = utils .to_constant (vim .wo [win ].statuscolumn );
300
301
301
- vim .wo [win ].numberwidth = 1 ;
302
- vim .wo [win ].statuscolumn = " %!v:lua.require('bars.statuscolumn').render(" .. buffer .. " ," .. win .. " )" ;
302
+ vim .wo [win ].numberwidth = 1 ;
303
+ vim .wo [win ].statuscolumn = " %!v:lua.require('bars.statuscolumn').render(" .. buffer .. " ," .. win .. " )" ;
304
+ end , 0 )
303
305
304
306
:: continue::
305
307
end
@@ -358,7 +360,7 @@ statuscolumn.setup = function (config)
358
360
statuscolumn .config = vim .tbl_extend (" force" , statuscolumn .config , config );
359
361
end
360
362
361
- for _ , window in ipairs (statuscolumn .state .attached_windows ) do
363
+ for window , _ in pairs (statuscolumn .state .attached_windows ) do
362
364
vim .w [window ].__scID = statuscolumn .update_id (window );
363
365
end
364
366
end
0 commit comments