Skip to content

Commit

Permalink
fix(window): account for winbar for preview in main. Fixes #468
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jun 2, 2024
1 parent 250ea79 commit 23ded52
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lua/trouble/view/window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,15 @@ function M:parent_size()
if self.opts.relative == "editor" or self.opts.relative == "cursor" then
return { width = vim.o.columns, height = vim.o.lines }
end
return { width = vim.api.nvim_win_get_width(self.opts.win), height = vim.api.nvim_win_get_height(self.opts.win) }
local ret = {
width = vim.api.nvim_win_get_width(self.opts.win),
height = vim.api.nvim_win_get_height(self.opts.win),
}
-- account for winbar
if vim.wo[self.opts.win].winbar ~= "" then
ret.height = ret.height - 1
end
return ret
end

---@param type "win" | "buf"
Expand Down

0 comments on commit 23ded52

Please sign in to comment.