From f399e8f79a56678788cbc0cb4a4b02bed7adce42 Mon Sep 17 00:00:00 2001 From: Will Hopkins Date: Fri, 13 Oct 2023 00:02:16 -0700 Subject: [PATCH] fix: use eval_statusline to determine title width (#46) * 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 --- lua/edgy/edgebar.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lua/edgy/edgebar.lua b/lua/edgy/edgebar.lua index 910080d..d50b98b 100644 --- a/lua/edgy/edgebar.lua +++ b/lua/edgy/edgebar.lua @@ -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