goolord / alpha-nvim

a lua powered greeter like vim-startify / dashboard-nvim
MIT License
1.82k stars 109 forks source link

Error when closing windows with alpha opened #168

Closed Bekaboo closed 1 year ago

Bekaboo commented 1 year ago

please read the documentation before asking questions about configuration or creating a feature request

for bugs: provide the expected behavior and the actual behavior, and screenshots if you want to be nice

Minimal config:

local alpha = require('alpha')
local dashboard = require('alpha.themes.dashboard')
alpha.setup(dashboard.opts)

To reproduce this issue:

  1. Install alpha with default config
  2. Open nvim by nvim
  3. Split window with <C-w>s or <C-w>v
  4. Close window with <C-w>o

Demo:

https://user-images.githubusercontent.com/76579810/211458731-e4dce6b4-9dbf-4ca5-a0ad-5ab573d5db25.mp4

bew commented 1 year ago

Hello, I'm getting the same error but with another workflow (but not the one you described):

  1. Install alpha with default config
  2. Open nvim by nvim
  3. Split window with s or v
  4. Open one of the recent file in the alpha buffer (only in one window, alpha is still visible in the other window)
  5. Close the window with the opened file (using :q for example)

And I get the error:

Error detected while processing CursorMoved Autocommands for "<buffer=1>":
Error executing lua callback: ...pack/lazy-managed-plugins/start/alpha-nvim/lua/alpha.lua:567: Invalid window id: 1000
stack traceback:
        [C]: in function 'nvim_win_get_cursor'
        ...pack/lazy-managed-plugins/start/alpha-nvim/lua/alpha.lua:567: in function 'move_cursor'
        ...pack/lazy-managed-plugins/start/alpha-nvim/lua/alpha.lua:473: in function <...pack/lazy-managed-plugins/start/alpha-nvim/lua/alpha.lua:473>

NOTE: Writing this comment, I noticed another bug: splitting the Alpha window actually doesn't work, the new window doesn't have the same bindings as the first window..

goolord commented 1 year ago

should be fixed in 704ff0fc0660caf85080f1443ccf6e03ea401fe6

Bekaboo commented 1 year ago

@goolord Hi, this is actually not fixed, and here is a demo of the bug:

https://user-images.githubusercontent.com/76579810/235388519-fc109330-0a75-49fe-90f6-01dc7b999cae.mp4

goolord commented 1 year ago

probably reintroduced by https://github.com/goolord/alpha-nvim/pull/201

goolord commented 1 year ago

reverted, confirmed it's fixed @Bekaboo

maybe i should get to writing tests for this plugin now, which i'm not totally sure how i'll do

Bekaboo commented 1 year ago

@goolord I tested it again and seems that it is only fixed for the startify theme but not for dashboard and theta. I'm testing against the default config, i.e. requirerequire'alpha'.setup(require'alpha.themes.theta'.config) and require('alpha').setup(require('alpha.themes.dashboard').config).

goolord commented 1 year ago

ok, i have made window handling a bit more principled, and this should be fixed in the theta and dashboard themes

goolord commented 1 year ago

https://github.com/goolord/alpha-nvim/commit/5b7ef660c6f80fbd04cccdf69624bf8c47513471#diff-ec96159a0e4ab00d2629897381414ffd88f8e88aa0b82e2f8ba6e24da2873239R621

this is what i was trying to avoid, ultimately, but neovim autocommands suck really bad for this usecase