fix(win): close help when leaving the win buffer

This commit is contained in:
Folke Lemaitre 2025-02-01 09:42:26 +01:00
parent e1566a483d
commit 4aba559c6e
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -372,6 +372,9 @@ function M:toggle_help(opts)
self:on("WinClosed", function()
win:close()
end, { win = true })
self:on("BufLeave", function()
win:close()
end, { buf = true })
local dim = win:dim()
local cols = math.floor((dim.width - 1) / col_width)
local rows = math.ceil(#self.keys / cols)