Skip to content

Commit

Permalink
feat: added sidebar as a prop of view
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jun 1, 2023
1 parent 794ab42 commit 4883d03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lua/edgy/sidebar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function M.new(pos, opts)
for _, v in ipairs(opts.views) do
v = type(v) == "string" and { ft = v } or v
---@cast v Edgy.View.Opts
table.insert(self.views, View.new(v))
table.insert(self.views, View.new(v, self))
end
self:on_win_enter()
return self
Expand Down
4 changes: 3 additions & 1 deletion lua/edgy/view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ local Window = require("edgy.window")
---@field size? Edgy.Size
---@field winbar? boolean
---@field pinned? boolean
---@field sidebar Edgy.Sidebar
---@field open? fun()
---@field close? fun()

Expand All @@ -17,8 +18,9 @@ local M = {}
M.__index = M

---@param opts Edgy.View.Opts
function M.new(opts)
function M.new(opts, sidebar)
local self = setmetatable(opts, M)
self.sidebar = sidebar
self.wins = {}
self.title = self.title or self.ft:sub(1, 1):upper() .. self.ft:sub(2)
self.size = self.size or {}
Expand Down

0 comments on commit 4883d03

Please sign in to comment.