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

index out of bounds #212

Closed SlartThunder closed 2 months ago

SlartThunder commented 2 months ago

Neovim version (nvim -v | head -n1)

NVIM v0.9.5

Operating system/version

macOS 14.4.1

How to reproduce the issue

I am using ufo plugin integrated as stated in https://github.com/kevinhwang91/nvim-ufo?tab=readme-ov-file#minimal-configuration Option2 using mason-lspconfig plugin.

When opening a file and trying to fold errors appear inline in buffer:

  1. When folding, in the folded lines a 0 is written rather than text
  2. When moving cursor into folded lines, a bunch of errors appear ufo: Error executing lua: ....../local/share/nvim/lazy/nvim-ufo/lua/ufo/model/buffer.lua:227: index out of bounds .... ufo: Error executing lua: ....../local/share/nvim/lazy/nvim-ufo/lua/ufo/decorator.lua:141 in function < ... decorator.lua:138 …

Then closing the buffer bdand openning again, I can close the folds with no more problems and everything works as expected.

The thing is that is quite annoying as you can imagine… No ufo.log in ~/.cache/nvim/

Expected behavior

Just fold the lines as usual.

Actual behavior

I am using ufo plugin integrated as stated in https://github.com/kevinhwang91/nvim-ufo?tab=readme-ov-file#minimal-configuration Option2 using mason-lspconfig plugin.

When opening a file and trying to fold errors appear inline in buffer:

  1. When folding, in the folded lines a 0 is written rather than text
  2. When moving cursor into folded lines, a bunch of errors appear ufo: Error executing lua: ....../local/share/nvim/lazy/nvim-ufo/lua/ufo/model/buffer.lua:227: index out of bounds .... ufo: Error executing lua: ....../local/share/nvim/lazy/nvim-ufo/lua/ufo/decorator.lua:141 in function < ... decorator.lua:138 …

Then closing the buffer bdand openning again, I can close the folds with no more problems and everything works as expected.

The thing is that is quite annoying as you can imagine… No ufo.log in ~/.cache/nvim/

kevinhwang91 commented 2 months ago

https://github.com/kevinhwang91/nvim-ufo/issues/47#issuecomment-1460742987