kevinhwang91 / nvim-ufo

Not UFO in the sky, but an ultra fold in Neovim.
BSD 3-Clause "New" or "Revised" License
2.16k stars 37 forks source link

Multiple windows with the same buffer make unfolding glitchy #187

Closed igorlfs closed 6 months ago

igorlfs commented 6 months ago

Neovim version (nvim -v | head -n1)

NVIM v0.10.0-dev-1854+g224b2ec202

Operating system/version

Linux 6.6.6

How to reproduce the issue

cat mini.lua

-- Use Vim packages install the plugin, also work with some plugins manager such as packer.nvim
vim.o.packpath = '~/.local/share/nvim/site'
vim.cmd('packadd promise-async')
vim.cmd('packadd nvim-ufo')

-- Setting
vim.o.foldcolumn = '1'
vim.o.foldlevel = 99
vim.o.foldlevelstart = -1
vim.o.foldenable = true

local ufo = require('ufo')
ufo.setup()
vim.keymap.set('n', 'zR', ufo.openAllFolds)
vim.keymap.set('n', 'zM', ufo.closeAllFolds)

nvim --clean +'so mini.lua'

  1. Open a buffer. <C-w>v to open another split with the same buffer.
  2. In the new split, close any fold.
  3. Close the same fold in the original split.
  4. Move to the new split again, and try to open it. ...

Expected behavior

The fold should be opened normally

Actual behavior

Instead, it glitches as if it had entered a loop, where the highlight on open is never cleared: image