anuvyklack / windows.nvim

Automatically expand width of the current window. Maximizes and restore it. And all this with nice animations!
MIT License
537 stars 15 forks source link

Error executing vim.schedule lua callback: ...l/share/nvim/lazy/windows.nvim/lua/windows/lib/frame.lua:98: attempt to index local 'curwinLeaf' (a nil value) #31

Closed nyngwang closed 1 year ago

nyngwang commented 1 year ago

Description

I have a session plugin, which can restore my project session consists of many tabpages. But I just noticed that restoring session where there are two vertical splits on enter caused an error:

   Error  23:01:23 msg_show.lua_error Error executing vim.schedule lua callback: ...l/share/nvim/lazy/windows.nvim/lua/windows/lib/frame.lua:98: attempt to index local 'curwinLeaf' (a nil value)
stack traceback:
    ...l/share/nvim/lazy/windows.nvim/lua/windows/lib/frame.lua:98: in function 'autowidth'
    .../nvim/lazy/windows.nvim/lua/windows/calculate-layout.lua:27: in function 'autowidth'
    ...l/share/nvim/lazy/windows.nvim/lua/windows/autowidth.lua:40: in function ''
    vim/_editor.lua: in function ''
    vim/_editor.lua: in function <vim/_editor.lua:0>

If I disable barbecue.nvim then the error is gone.

Reproduce

To reproduce, you can use my config (assuming you use packer.nvim):

If I use the following config:

use {
  'anuvyklack/windows.nvim',
  dependencies = {
    'anuvyklack/middleclass',
    'anuvyklack/animation.nvim'
  },
  config = function()
    vim.o.winwidth = 10
    vim.o.winminwidth = 10
    vim.o.equalalways = false
    require('windows').setup {
      autowidth = { enable = true },
      ignore = {
        filetype = { 'neo-tree', 'lazy', 'noice' },
      }
    }
    -- and some `vim.keymap.set` omitted.
  end
}

https://user-images.githubusercontent.com/24765272/209852868-a8e2d7e1-c960-4a11-9cc2-f0c75a448d5f.mov

nyngwang commented 1 year ago

The problem turned out to be unrelated to barbecue.nvim, and there is no problem. Closing...

towry commented 1 year ago

I have same issue triggered by bdelete