Skip to content

Commit 6f37dfb

Browse files
committed
fix: Fixed a bug that resets special windows bars & lines
1 parent ec171b1 commit 6f37dfb

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

lua/bars/statuscolumn.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,11 @@ statuscolumn.detach = function (window)
336336

337337
vim.schedule(function ()
338338
if not window or vim.api.nvim_win_is_valid(window) == false then
339+
-- Invalid window.
340+
return;
341+
elseif vim.wo[window].statuscolumn ~= STC then
342+
-- Do not attempt to modify window's statuscolumn
343+
-- if the statuscolumn isn't the one we set.
339344
return;
340345
end
341346

lua/bars/statusline.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,11 @@ statusline.detach = function (window)
408408

409409
vim.schedule(function ()
410410
if not window or vim.api.nvim_win_is_valid(window) == false then
411+
-- Invalid window.
412+
return;
413+
elseif vim.wo[window].statusline ~= STL then
414+
-- Do not attempt to modify window's statusline
415+
-- if the statusline isn't the one we set.
411416
return;
412417
end
413418

lua/bars/winbar.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,15 @@ winbar.detach = function (window)
726726
---|fS
727727

728728
vim.schedule(function ()
729+
if not window or vim.api.nvim_win_is_valid(window) == false then
730+
-- Invalid window.
731+
return;
732+
elseif vim.wo[window].statuscolumn ~= WBR then
733+
-- Do not attempt to modify window's winbar
734+
-- if the winbar isn't the one we set.
735+
return;
736+
end
737+
729738
pcall(function ()
730739
vim.w[window].__wbID = nil;
731740

0 commit comments

Comments
 (0)