edgy.nvim
edgy.nvim copied to clipboard
bug: inconsistent folding with dynamic titles / winbar
Did you check docs and existing issues?
- [X] I have read all the edgy.nvim docs
- [X] I have searched the existing issues of edgy.nvim
- [X] I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
NVIM 0.10 nightly
Operating system/version
Arch Linux, 6.5.2-arch1-1
Describe the bug
When using dynamic titles (title = "%{%v:lua.custom_edgy_title()%}"
), the width of a window is not calculated properly when folded. This leads to some windows getting wider when folded because highlight attrs / the result of the expr are not accounted for.
Steps To Reproduce
- Create an edgy view for a filetype in the
bottom
ortop
view (where title width affects folded width). - Create a custom title function in the global namespace
- Open the view, and another view next to it so it can be folded (terminal and qf in minimal init)
- Fold the view
The width of the folded view will not be the same as the actual text width of the winbar.
Expected Behavior
The window should be folded to the text width of the winbar.
Repro
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
"folke/edgy.nvim",
-- add any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
function _G.custom_edgy_title()
return "%#EdgyTitle#Test%#*"
end
require("edgy").setup({
bottom = {
{
ft = "qf",
title = "%{%v:lua.custom_edgy_title()%}",
},
{
ft = "terminal",
title = "%{%v:lua.custom_edgy_title()%}",
},
},
})
vim.api.nvim_create_autocmd("TermOpen", {
callback = function(ev)
vim.bo[ev.buf].filetype = "terminal"
end
})