Repository navigation
Open
Labels
bugSomething isn't working
Description
Neovim version (nvim -v | head -n1)
NVIM v0.10.0-dev-2296+gcca8a78ea
Operating system/version
Windows 11 (WSL)
How to reproduce the issue
I don't have any repro.lua but I can show a video of the problem followed by my UFO config.
EDIT : Happens when vim option wrap is set to false
Video :
ufo.mp4
Ufo config :
local handler = function(virtText, lnum, endLnum, width, truncate)
local newVirtText = {}
local suffix = (" %d "):format(endLnum - lnum)
local sufWidth = vim.fn.strdisplaywidth(suffix)
local targetWidth = width - sufWidth
local curWidth = 0
for _, chunk in ipairs(virtText) do
local chunkText = chunk[1]
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
if targetWidth > curWidth + chunkWidth then
table.insert(newVirtText, chunk)
else
chunkText = truncate(chunkText, targetWidth - curWidth)
local hlGroup = chunk[2]
table.insert(newVirtText, { chunkText, hlGroup })
chunkWidth = vim.fn.strdisplaywidth(chunkText)
-- str width returned from truncate() may less than 2nd argument, need padding
if curWidth + chunkWidth < targetWidth then
suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth)
end
break
end
curWidth = curWidth + chunkWidth
end
table.insert(newVirtText, { suffix, "MoreMsg" })
return newVirtText
end
return {
"kevinhwang91/nvim-ufo",
event = "BufReadPost",
opts = {
provider_selector = function(bufnr, filetype, buftype)
return { "treesitter", "indent" }
end,
fold_virt_text_handler = handler,
preview = {
win_config = {
winhighlight = "Normal:Folded",
winblend = 0,
},
mappings = {
scrollU = "<C-u>",
scrollD = "<C-d>",
jumpTop = "[",
jumpBot = "]",
},
},
},
dependencies = {
{ "kevinhwang91/promise-async" },
{
"luukvbaal/statuscol.nvim",
opts = {
foldfunc = "builtin",
setopt = true,
relculright = true,
},
config = function(_, opts)
require("statuscol").setup(vim.tbl_deep_extend("force", opts, {
segments = {
{ text = { "%s" }, click = "v:lua.ScSa" },
{ text = { require("statuscol.builtin").lnumfunc, " " }, click = "v:lua.ScLa" },
{ text = { require("statuscol.builtin").foldfunc, " " }, click = "v:lua.ScFa" },
},
}))
end,
},
},
}Expected behavior
1 - Fold a function
2 - Move horizontally
3 - Fold is staying at its position
Actual behavior
1 - Fold a function
2 - Move horizontally
3 - Fold is following cursor horizontal moovements
Reacted by Rizky Ilham Pratama and sxwpb
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity