kevinhwang91 / nvim-ufo

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

[Bug] Searching within a fold closes it #27

Closed akinsho closed 2 years ago

akinsho commented 2 years ago

Neovim version (nvim -v | head -n1)

NVIM v0.8.0-dev+1941-gb7084fef4

Operating system/version

macOS 12.4

How to reproduce the issue

  1. Use the following init.lua via nvim -u <minimal-init> --no-plugin <file-with-folds>
    
    vim.cmd("packadd! nvim-ufo")

vim.opt.termguicolors = true vim.opt.foldlevelstart = 2 vim.opt.foldenable = true

require("ufo").setup()


2. go to a closed fold, open it with `zo`
3. search for any item within the fold using either `:call search('thing')` or `/thing<CR>`
4. Fold is closed

### Expected behavior

Searching inside a folded area should not cause the fold to be closed

### Actual behavior

Searching inside a folded area causes the fold to close back up

https://user-images.githubusercontent.com/22454918/176205985-23cfdf2d-3310-4c4f-9849-796e823f5a67.mov
kevinhwang91 commented 2 years ago

ufo listen CmdlineLeave to update the fold. The issue is similar to https://github.com/kevinhwang91/nvim-ufo/issues/7 Set a large foldlevel value.

kevinhwang91 commented 2 years ago

can be improved by checking the changedtick.