Skip to content

[BUG] Invalid window id when using tab direction #659

@PurpleMyst

Description

@PurpleMyst

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Sometimes, when toggling a terminal opened in the "tab" direction, I get this error:

Error executing Lua callback: ...cal/nvim-data/lazy/toggleterm.nvim/lua/toggleterm/ui.lua:351: Invalid window id: 1690
stack traceback:
        [C]: in function 'nvim_win_close'
        ...cal/nvim-data/lazy/toggleterm.nvim/lua/toggleterm/ui.lua:351: in function 'close_tab'
        ...cal/nvim-data/lazy/toggleterm.nvim/lua/toggleterm/ui.lua:398: in function 'close'
        ...im-data/lazy/toggleterm.nvim/lua/toggleterm/terminal.lua:288: in function 'close'
        ...cal/nvim-data/lazy/toggleterm.nvim/lua/toggleterm/ui.lua:443: in function 'close_and_save_terminal_view'
        .../Local/nvim-data/lazy/toggleterm.nvim/lua/toggleterm.lua:67: in function 'smart_toggle'
        .../Local/nvim-data/lazy/toggleterm.nvim/lua/toggleterm.lua:297: in function 'toggle'
        .../Local/nvim-data/lazy/toggleterm.nvim/lua/toggleterm.lua:270: in function 'toggle_command'
        .../Local/nvim-data/lazy/toggleterm.nvim/lua/toggleterm.lua:425: in function <.../Local/nvim-data/lazy/toggleterm.nvim/lua/toggleterm.lua:425>

Expected Behavior

There should be no error.

Steps To Reproduce

  1. Open toggleterm in the tab direction
  2. Leave by :bp
  3. Re-open toggleterm
  4. Try to close toggleterm (via :ToggleTerm)

Environment

- OS: Windows 11
- neovim version: NVIM v0.11.3
- Shell: pwsh

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions