Skip to content

Commit

Permalink
fix: use eval_statusline to determine title width (#46)
Browse files Browse the repository at this point in the history
* fix: use eval_statusline to determine title width

* fix: only use nvim_eval_statusline to determine title width when available

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
  • Loading branch information
willothy and folke committed Oct 13, 2023
1 parent 4a4bab4 commit f399e8f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lua/edgy/edgebar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,17 @@ function M:resize()
elseif win.visible then
auto[#auto + 1] = win
-- hidden windows
elseif self.vertical then
win[long] = 1
else
win[long] = self.vertical and 1 or (vim.fn.strdisplaywidth(win.view.title) + 3)
local title_width = vim.fn.strdisplaywidth(win.view.title)
if vim.api.nvim_eval_statusline then
title_width = vim.api.nvim_eval_statusline(win.view.title, {
use_winbar = true,
winid = win.win,
}).width
end
win[long] = title_width + 3
end
free = free - win[long]
end
Expand Down

0 comments on commit f399e8f

Please sign in to comment.