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

Closing the infoview buffer with :q! causes errors #346

Closed
stephen-huan opened this issue Jul 17, 2024 · 3 comments
Closed

Closing the infoview buffer with :q! causes errors #346

stephen-huan opened this issue Jul 17, 2024 · 3 comments

Comments

@stephen-huan
Copy link

If I close the infoview window manually with :q!, it errors with

Error executing vim.schedule lua callback: ...mPackages/start/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: ...k/myNeovimPackages/start/lean.nv
im/lua/lean/infoview.lua:680: Invalid window id: 1002
stack traceback:
        [C]: in function 'error'
        ...mPackages/start/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
        ...mPackages/start/plenary.nvim/lua/plenary/async/async.lua:45: in function 'handler'
        ...wrapped-0.10.0/share/nvim/runtime/lua/vim/lsp/client.lua:685: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>
Press ENTER or type command to continue

and these errors happen periodically afterwards when I move my cursor as well. Since these errors don't happen with :q, I thought it may be a difference in the autocmd trigger order. Below is what autocmds trigger with :q

18:56:46 - Started autocmd log (2024-07-17)
18:56:46 - CursorHold
18:56:49 - QuitPre
18:56:49 - BufLeave
18:56:49 - WinLeave
18:56:49 - WinClosed
18:56:49 - BufWinLeave
18:56:49 - BufHidden
18:56:49 - WinEnter
18:56:49 - BufEnter
18:56:49 - CursorMoved
18:56:49 - User
18:56:50 - CursorHold
18:56:52 - Stopped autocmd log (2024-07-17)

and with :q!. Note that unlike with :q, WinClosed activates immediately and then again slightly later.

18:57:07 - Started autocmd log (2024-07-17)
18:57:07 - CursorHold
18:57:08 - WinClosed
18:57:08 - BufWinLeave
18:57:08 - BufHidden
18:57:10 - QuitPre
18:57:10 - BufLeave
18:57:10 - WinLeave
18:57:10 - WinClosed
18:57:10 - BufWinLeave
18:57:10 - BufUnload
18:57:10 - WinEnter
18:57:10 - BufEnter
18:57:10 - CursorMoved
18:57:11 - User
18:57:12 - CursorHold
18:57:13 - Stopped autocmd log (2024-07-17)

Related to #20 but the error is slightly different: window id vs buffer id.

@stephen-huan
Copy link
Author

Indirectly addressed by #43, which I would love to see finally merged as well.

@Julian Julian closed this as completed in ce28e14 Jul 18, 2024
@Julian
Copy link
Owner

Julian commented Jul 18, 2024

I'd somewhat say "don't do that" :) as using :q! on a buffer with no modifications is pointless, but nonetheless given this wasn't impossible to work around I've pushed a fix. Give it a shot and feel free to let me know if you notice anything else!

@stephen-huan
Copy link
Author

Give it a shot and feel free to let me know if you notice anything else!

It works, thanks for the fix!

I'd somewhat say "don't do that" :) as using :q! on a buffer with no modifications is pointless, but nonetheless given this wasn't impossible to work around I've pushed a fix.

I agree, the reason is I have <ctrl-q> bound to :q! so I use that shortcut reflexively to close any window. I've been using #43 (comment) so I don't need to do this manually anymore, thankfully. I raised the issue because, well, the dual to ":q! is the same as :q so don't do :q!" is ":q! is the same as :q so both should work" :p.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants