Skip to content

Commit 1d5ab23

Browse files
committed
fix(statuscolumn): Fixed a bug with errors when trying to detach from invalid windows
fix(statuscolumn): No longer detach from windows that weren't attached This needs more work!
1 parent de3c702 commit 1d5ab23

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lua/bars/statuscolumn.lua

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,6 @@ statuscolumn.render = function ()
205205
return "";
206206
elseif statuscolumn.state.attached_windows[window] ~= true then
207207
--- We aren't attached to this window.
208-
--- Detach and exit.
209-
statuscolumn.detach(window);
210208
return "";
211209
end
212210

@@ -272,6 +270,10 @@ statuscolumn.detach = function (window)
272270
---|fS
273271

274272
vim.schedule(function ()
273+
if not window or vim.api.nvim_win_is_valid(window) == false then
274+
return;
275+
end
276+
275277
vim.w[window].__scID = nil;
276278

277279
vim.api.nvim_set_option_value(
@@ -339,7 +341,9 @@ end
339341
statuscolumn.attach = function (window)
340342
---|fS
341343

342-
if statuscolumn.state.enable == false then
344+
if not window or vim.api.nvim_win_is_valid(window) == false then
345+
return;
346+
elseif statuscolumn.state.enable == false then
343347
return;
344348
elseif statuscolumn.can_attach(window) == false then
345349
return;

0 commit comments

Comments
 (0)