numToStr / FTerm.nvim

:fire: No-nonsense floating terminal plugin for neovim :fire:
MIT License
721 stars 24 forks source link

fix(window): make sure last_win is valid before setting current window #74

Closed utilyre closed 1 year ago

utilyre commented 1 year ago

This prevents nvim from throwing "Invalid window ID" error when fterm gets opened and the window which it was opened on (last_win) gets closed (e.g. nvim-tree).

To reproduce the bug, set view.float.enable to true in nvim-tree's config. Then open nvim-tree and open a terminal instance while nvim-tree is the current window. Now if you toggle the terminal, you'll get an error saying "Invalid window ID" because nvim-tree has already closed its own window due to another floating window being opened on top of it.