Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Split preview opens all folds #459

Closed
3 tasks done
Tired-Fox opened this issue May 31, 2024 · 1 comment · Fixed by #461
Closed
3 tasks done

bug: Split preview opens all folds #459

Tired-Fox opened this issue May 31, 2024 · 1 comment · Fixed by #461
Labels
bug Something isn't working

Comments

@Tired-Fox
Copy link

Tired-Fox commented May 31, 2024

Did you check docs and existing issues?

  • I have read all the trouble.nvim docs
  • I have searched the existing issues of trouble.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

0.10.0

Operating system/version

Windows 10 22H2

Describe the bug

When using the split preview from the examples, hovering/selected a single item opens all folds. I assume this is how the preview/trouble windows are refreshed in the split.

I tested this with type main and type float for the preview and both retain the fold state.

Steps To Reproduce

  1. trouble window is open with a preview setup with
{
  -- ...
  preview = {
    type = "split",
    relative = "win",
    position = "right",
    size = 0.5,
  }
  -- ...
}
  1. all folds are closed (zM)
  2. one fold is opened (za)
  3. an item is hovered/selected
  4. preview is refreshed along with the trouble window
  5. all folds are opened

Expected Behavior

When hovering/selecting an item the folds stay folded.

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repo
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/trouble.nvim",
  -- add any other plugins here
  {
    "nvim-telescope/telescope.nvim",
    tag = "0.1.8",
    name = "telescope",
    dependencies = {
      "nvim-lua/plenary.nvim",
    }
    config = function()
        require("telescope").setup({
	  defaults = {
	    mappings = {
		n = { ["<c-t>"] = open_with_trouble },
	    },
         }
        })
    end
  }
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
@Tired-Fox Tired-Fox added the bug Something isn't working label May 31, 2024
@folke folke closed this as completed in 29d1bb8 Jun 3, 2024
@Tired-Fox
Copy link
Author

🎊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant