NeogitOrg / neogit

An interactive and powerful Git interface for Neovim, inspired by Magit
MIT License
4.1k stars 242 forks source link

Fix regression when closing last window #1428

Closed AlexanderArvidsson closed 4 months ago

AlexanderArvidsson commented 4 months ago

This PR fixes a regression introduced by e69c1b01b4cf0803cad5d7e49430af16760be55c, which wraps the closing by schedule_wrap. However, by wrapping it, pcall will never catch the error by nvim_win_close, causing a regression.

Adds a utility to safely close the window, since multiple places called nvim_win_close without handling the potential failure.

Fixes #1423.

One concern is the possibility that nvim_buf_delete in Buffer:hide could cause a similar error, but might be premature to add safety to this.

CKolkey commented 4 months ago

Much appreciated 🙏🏼