1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-23 00:33:02 +01:00

Show previous window instead of Home after closing a window

This commit is contained in:
jfreegman 2021-01-25 17:09:23 -05:00
parent f643975941
commit 07a41f9e0b
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63

View File

@ -367,7 +367,9 @@ void set_active_window_index(uint8_t index)
} }
} }
/* Shows next window when tab or back-tab is pressed */ /* Displays the next window if `ch` is equal to the next window key binding.
* Otherwise displays the previous window.
*/
void set_next_window(int ch) void set_next_window(int ch)
{ {
if (ch == user_settings->key_next_tab) { if (ch == user_settings->key_next_tab) {
@ -394,8 +396,6 @@ void set_next_window(int ch)
/* Deletes window w and cleans up */ /* Deletes window w and cleans up */
void del_window(ToxWindow *w) void del_window(ToxWindow *w)
{ {
set_active_window_index(0);
uint8_t idx = w->index; uint8_t idx = w->index;
delwin(w->window_bar); delwin(w->window_bar);
delwin(w->window); delwin(w->window);
@ -404,8 +404,12 @@ void del_window(ToxWindow *w)
clear(); clear();
refresh(); refresh();
if (num_active_windows > 0) {
set_next_window(-1);
--num_active_windows; --num_active_windows;
} }
}
ToxWindow *init_windows(Tox *m) ToxWindow *init_windows(Tox *m)
{ {