Skip to content

Commit

Permalink
fix(window): dont pass window to winbar and click handler. Fixes #55
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Oct 14, 2023
1 parent 48c9928 commit 2a5133c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lua/edgy/window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function M.new(win, view)
if vim.api.nvim_win_get_height(win) == 1 then
vim.api.nvim_win_set_height(win, 2)
end
wo.winbar = "%!v:lua.edgy_winbar(" .. win .. ")"
wo.winbar = "%!v:lua.require'edgy.window'.edgy_winbar()"
elseif wo.winbar == false then
wo.winbar = nil
end
Expand Down Expand Up @@ -139,7 +139,7 @@ function M:winbar()
---@type string[]
local parts = {}

parts[#parts + 1] = "%" .. self.win .. "@v:lua.edgy_click@"
parts[#parts + 1] = "%" .. self.win .. "@v:lua.require'edgy.window'.edgy_click@"
local icon_hl = self:is_pinned() and not self.view.opening and "EdgyIcon" or "EdgyIconActive"
local icon = self.visible and Config.icons.open or Config.icons.closed
if self.view.opening then
Expand Down Expand Up @@ -196,14 +196,14 @@ function M:apply_size()
return changes
end

---@diagnostic disable-next-line: global_usage
function _G.edgy_winbar(win)
function M.edgy_winbar()
local win = vim.g.statusline_winid
local window = M.cache[win]
return window and window:winbar() or ""
end

---@diagnostic disable-next-line: global_usage
function _G.edgy_click(win)
function M.edgy_click()
local win = vim.fn.getmousepos().winid
local window = M.cache[win]
if window then
window:toggle()
Expand Down

0 comments on commit 2a5133c

Please sign in to comment.