Switch to "other" window if closing active window

master
C. McEnroe 2020-02-09 00:39:09 -05:00
parent b30b93f672
commit e0714a9b7e
1 changed files with 5 additions and 1 deletions

4
ui.c
View File

@ -578,8 +578,12 @@ void uiShowNum(size_t num) {
static void windowClose(struct Window *window) { static void windowClose(struct Window *window) {
if (window->id == Network) return; if (window->id == Network) return;
if (windows.active == window) { if (windows.active == window) {
if (windows.other && windows.other != window) {
windowShow(windows.other);
} else {
windowShow(window->prev ? window->prev : window->next); windowShow(window->prev ? window->prev : window->next);
} }
}
if (windows.other == window) windows.other = NULL; if (windows.other == window) windows.other = NULL;
windowRemove(window); windowRemove(window);
for (size_t i = 0; i < BufferCap; ++i) { for (size_t i = 0; i < BufferCap; ++i) {