nvim-neo-tree / neo-tree.nvim

Neovim plugin to manage the file system and other tree like structures.
MIT License
3.71k stars 218 forks source link

BUG: UI gets all screwed up when scrolling on code or the neo-tree itself #1534

Open hrqmonteiro opened 2 months ago

hrqmonteiro commented 2 months ago

Did you check docs and existing issues?

Neovim Version (nvim -v)

0.10.

Operating System / Version

openSuse Tumbleweed

Describe the Bug

When i scroll my code the Neo-Tree interface gets all bugged

Screenshots, Traceback

https://github.com/user-attachments/assets/3a1bb63d-2a71-4502-a047-8cfe48e9556b

Steps to Reproduce

Just open it and scroll code

Expected Behavior

Not to be bugged

Your Configuration

return {
  {
    "nvim-neo-tree/neo-tree.nvim",
    branch = "v3.x",
    dependencies = {
      "nvim-lua/plenary.nvim",
      "MunifTanjim/nui.nvim",
      "3rd/image.nvim",
    },
    config = function()
      require("neo-tree").setup({
        close_if_last_window = true,
        default_component_configs = {
          git_status = {
            symbols = {
              -- Change type
              added     = "+", -- or "✚", but this is redundant info if you use git_status_colors on the name
              modified  = "~", -- or "", but this is redundant info if you use git_status_colors on the name
              deleted   = "-", -- this can only be used in the git_status source
              renamed   = "~", -- this can only be used in the git_status source
              -- Status type
              untracked = "",
              ignored   = "",
              unstaged  = "",
              staged    = "",
              conflict  = "",
            }
          },
          indent = {
            with_expanders = true, -- if nil and file nesting is enabled, will enable expanders
            expander_collapsed = "",
            expander_expanded = "",
            with_markers = false,
            expander_highlight = "NeoTreeFileIcon"
          },
          name = {
            use_git_status_colors = false
          },
        },
        filesystem = {
          filtered_items = {
            hide_dotfiles = false,
            hide_gitignored = false,
            hide_hidden = false
          }
        },
        window = {
          position = "right",
          width = 30
        }
      })
    end
  }
}
miversen33 commented 2 months ago

I am afraid we are going to need more details on this. Can you tell us what version exactly of neo-tree you're using?

I suppose additionally, this might not be an issue with neotree at all and could be related to something higher up the stack. I say this because I notice that when you move the cursor to the neo-tree buffer, it "fixes" the line that you are on in neo-tree. There is no logic in neo-tree that does per-line refreshing so this might be related to another plugin or neovim altogether.

Lastly, please don't omit the configuration that is provided in the bug report.

I cannot recreate your issue, here is the config I used (I took your config and put it in the lazy config we provide in the bug report template)

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

-- set stdpaths to use .repro
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",
    -- add any other plugins here
}

local neotree_config = {
    "nvim-neo-tree/neo-tree.nvim",
    dependencies = { "MunifTanjim/nui.nvim", "nvim-tree/nvim-web-devicons", "nvim-lua/plenary.nvim" },
    cmd = { "Neotree" },
    keys = {
        { "<Leader>e", "<Cmd>Neotree<CR>" }, -- change or remove this line if relevant.
    },
    opts = {
        -- Your config here
        {
            "nvim-neo-tree/neo-tree.nvim",
            branch = "v3.x",
            dependencies = {
                "nvim-lua/plenary.nvim",
                "MunifTanjim/nui.nvim",
                "3rd/image.nvim",
            },
            config = function()
                require("neo-tree").setup({
                    close_if_last_window = true,
                    default_component_configs = {
                        git_status = {
                            symbols = {
                                -- Change type
                                added     = "+", -- or "✚", but this is redundant info if you use git_status_colors on the name
                                modified  = "~", -- or "", but this is redundant info if you use git_status_colors on the name
                                deleted   = "-", -- this can only be used in the git_status source
                                renamed   = "~", -- this can only be used in the git_status source
                                -- Status type
                                untracked = "",
                                ignored   = "",
                                unstaged  = "",
                                staged    = "",
                                conflict  = "",
                            }
                        },
                        indent = {
                            with_expanders = true, -- if nil and file nesting is enabled, will enable expanders
                            expander_collapsed = "",
                            expander_expanded = "",
                            with_markers = false,
                            expander_highlight = "NeoTreeFileIcon"
                        },
                        name = {
                            use_git_status_colors = false
                        },
                    },
                    filesystem = {
                        filtered_items = {
                            hide_dotfiles = false,
                            hide_gitignored = false,
                            hide_hidden = false
                        }
                    },
                    window = {
                        position = "right",
                        width = 30
                    }
                })
            end
        }
    },
}

table.insert(plugins, neotree_config)
require("lazy").setup(plugins, {
    root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

This was tested against neovim 0.10.0 stable

miversen33 commented 2 months ago

Note, I notice you are using wezterm. Probably worth checking out 4607, I remember seeing some weird artifacting with neovim in wezterm's muxer (IIRC it was the muxer).

Anyway, see if this fixes your issue: https://github.com/wez/wezterm/issues/4607#issuecomment-1831628722

As a workaround, you can just disable this in neovim: set notermsync or in lua: vim.opt.termsync = false.

hrqmonteiro commented 2 months ago

Note, I notice you are using wezterm. Probably worth checking out 4607, I remember seeing some weird artifacting with neovim in wezterm's muxer (IIRC it was the muxer).

Anyway, see if this fixes your issue: wez/wezterm#4607 (comment)

As a workaround, you can just disable this in neovim: set notermsync or in lua: vim.opt.termsync = false.

Did the same as you, ran the config you used with nvim -u, and also not only on Wezterm, but also on Konsole. Same thing happens.

Tried notermsync as well.

See it, please:

https://github.com/user-attachments/assets/0395b044-f567-49f2-bf0d-3de07076127c

miversen33 commented 2 months ago

For giggles, try running the minimal configuration I provided with the following command

nvim --clean -u minimal.lua

Also, can you provide the output of

nvim --version

You are experiencing some weird buffer arficating. This is not neotree causing this issue (at least not directly) but its possible that there is some weird setting that has been modified on splits and the like.

I say its not neotree causing the issue because when you are scrolling in the right buffer, it is partially overwriting the cells on the right side of the left (neotree) buffer. This is neovim doing weird stuff.

hrqmonteiro commented 2 months ago

For giggles, try running the minimal configuration I provided with the following command

nvim --clean -u minimal.lua

Also, can you provide the output of

nvim --version

You are experiencing some weird buffer arficating. This is not neotree causing this issue (at least not directly) but its possible that there is some weird setting that has been modified on splits and the like.

I say its not neotree causing the issue because when you are scrolling in the right buffer, it is partially overwriting the cells on the right side of the left (neotree) buffer. This is neovim doing weird stuff.

via  v5.1.5 on 󰸏  (sa-east-1) took 15s   nvim --version
NVIM v0.10.0
Build type: RelWithDebInfo
LuaJIT 2.1.1707061634
Run "nvim -V1 -v" for more info

with the --clean flag i had the same output, unfortunately

miversen33 commented 2 months ago

It appears you are a slightly older version of neovim. What happens if you try the current stable version?

hrqmonteiro commented 2 months ago

It appears you are a slightly older version of neovim. What happens if you try the current stable version?

Just compiled from the git repo and the same thing happened:

https://github.com/user-attachments/assets/68fd190c-d9af-4631-a37a-1c0943a90c79