Skip to content

Commit

Permalink
chore: remove debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcuts committed Nov 28, 2023
1 parent d4d7d6e commit 9e83975
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
4 changes: 2 additions & 2 deletions lua/no-neck-pain/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function N.enable(scope)
end

-- if we are not in split view, we check if we killed one of the main buffers (curr, left, right) to disable NNP
if not S.hasSplits(S) and not W.stateWinsActive(p.event, false) then
if not S.hasSplits(S) and not W.stateWinsActive(false) then
D.log(p.event, "one of the NNP main buffers have been closed, disabling...")

return N.disable(p.event)
Expand Down Expand Up @@ -252,7 +252,7 @@ function N.enable(scope)
vim.api.nvim_create_autocmd({ "WinClosed", "BufDelete" }, {
callback = function(p)
vim.schedule(function()
if E.skip(nil) or not S.hasSplits(S) or W.stateWinsActive(p.event, true) then
if E.skip(nil) or not S.hasSplits(S) or W.stateWinsActive(true) then
return
end

Expand Down
11 changes: 1 addition & 10 deletions lua/no-neck-pain/wins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -294,30 +294,23 @@ end

---Determine if the tab wins are still active and valid.
---
---@param scope string: the method that called this one.
---@param checkSplits boolean: whether splits state should be considered or not.
---@return boolean: whether all windows are active and valid or not.
---@private
function W.stateWinsActive(scope, checkSplits)
function W.stateWinsActive(checkSplits)
if not S.isActiveTabValid(S) then
D.log(scope, "active tab not valid")

return false
end

local tab = S.getTabSafe(S)

if tab == nil then
D.log(scope, "tab is nil")

return false
end

if tab.wins.main ~= nil then
for _, side in pairs(tab.wins.main) do
if not vim.api.nvim_win_is_valid(side) then
D.log(scope, "main not valid anymore")

return false
end
end
Expand All @@ -326,8 +319,6 @@ function W.stateWinsActive(scope, checkSplits)
if checkSplits and tab.wins.splits ~= nil then
for _, split in pairs(tab.wins.splits) do
if not vim.api.nvim_win_is_valid(split.id) then
D.log(scope, "split not valid anymore")

return false
end
end
Expand Down

0 comments on commit 9e83975

Please sign in to comment.