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: Uncaught exceptions when interacting with blank line #1233

Open
3 tasks done
FalcoGer opened this issue Nov 13, 2023 · 1 comment
Open
3 tasks done

BUG: Uncaught exceptions when interacting with blank line #1233

FalcoGer opened this issue Nov 13, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@FalcoGer
Copy link

Did you check docs and existing issues?

  • I have read all the docs.
  • I have searched the existing issues.
  • I have searched the existing discussions.

Neovim Version (nvim -v)

NVIM v0.10.0-dev-e59cf3b3a

Operating System / Version

Ubuntu Mate 22.04

Describe the Bug

When add_blank_line_at_top = true a blank line is inserted at the top of the tree. When interacting with this blank like, for example using open or toggle, an exception is thrown.

Screenshots, Traceback

E5108: Error executing lua: ...d/neo-tree.nvim/lua/neo-tree/sources/common/commands.lua:682: attempt to index local 'node' (a nil value)
stack traceback:
...d/neo-tree.nvim/lua/neo-tree/sources/common/commands.lua:682: in function 'open_with_cmd'
...d/neo-tree.nvim/lua/neo-tree/sources/common/commands.lua:741: in function 'open'
...o-tree.nvim/lua/neo-tree/sources/filesystem/commands.lua:184: in function <...o-tree.nvim/lua/neo-tree/sources/filesystem/commands.lua:183>

image

Steps to Reproduce

  1. Enable add_blank_line_at_top
  2. Open :Neotree
  3. Navigate to the blank line
  4. Hit

Expected Behavior

Nothing should happen

Your Configuration

-- 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 = {
    add_blank_line_at_top = true,
    -- ...
  },
}

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

vim.cmd.colorscheme("tokyonight")
-- add anything else here
@FalcoGer FalcoGer added the bug Something isn't working label Nov 13, 2023
@pysan3 pysan3 self-assigned this Mar 12, 2024
@pysan3
Copy link
Collaborator

pysan3 commented Mar 12, 2024

Just to inform you, this will be fixed with

which will take pretty long tho.

Please be careful not to hit an empty line is all I can say for now lol.
That empty head line option was added relatively recently and some parts of the code still assume that there is definitely a node for each line.

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

No branches or pull requests

2 participants