Skip to content

Commit

Permalink
fix(autocmds): allow registering rerouting for toggle option (#324)
Browse files Browse the repository at this point in the history
## 📃 Summary

scratchPads can be enabled on toggle, meaning that we should register
the autocmd even with scratchPads enabled and determine if we should
skip the re-routing at the autocmd level
  • Loading branch information
shortcuts committed Mar 24, 2024
1 parent e6c261d commit 28f433c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lua/no-neck-pain/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -354,14 +354,12 @@ function N.enable(scope)
desc = "Resize to apply on WinEnter/Closed of an integration",
})

if
_G.NoNeckPain.config.autocmds.skipEnteringNoNeckPainBuffer and not S.hasScratchPadEnabled(S)
then
if _G.NoNeckPain.config.autocmds.skipEnteringNoNeckPainBuffer then
vim.api.nvim_create_autocmd({ "WinLeave" }, {
callback = function(p)
vim.schedule(function()
p.event = string.format("%s:skipEnteringNoNeckPainBuffer", p.event)
if not S.hasTabs(S) or not S.isActiveTabRegistered(S) or E.skip() then
if not S.hasTabs(S) or not S.isActiveTabRegistered(S) or E.skip() or S.hasScratchPadEnabled(S) then
return D.log(p.event, "skip")
end

Expand Down

0 comments on commit 28f433c

Please sign in to comment.