From e85a89269be2f7d4cfe3c999a2b68097227c3e52 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Mon, 1 Mar 2021 17:41:24 -0500 Subject: change active node when current one closed --- main.c | 2 +- node.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index b96deaa..8a514ea 100644 --- a/main.c +++ b/main.c @@ -1,7 +1,7 @@ // @TODO: -// - fix: after closing last tab in active node, there should be a new active node // - Windows installation // - test on BSD +// - .deb file // - completion diff --git a/node.c b/node.c index 7facab2..be92638 100644 --- a/node.c +++ b/node.c @@ -105,6 +105,7 @@ static void node_close(Ted *ted, u16 node_idx) { ted->nodes_used[node_idx] = false; Node *node = &ted->nodes[node_idx]; + bool was_active = ted->active_node == node; // delete all associated buffers arr_foreach_ptr(node->tabs, u16, tab) { @@ -132,7 +133,7 @@ static void node_close(Ted *ted, u16 node_idx) { *parent = ted->nodes[other_side]; ted->nodes_used[other_side] = false; - if (ted->active_node == node) { + if (was_active) { Node *new_active_node = parent; // make sure we don't set the active node to a split while (!new_active_node->tabs) -- cgit v1.2.3