summaryrefslogtreecommitdiff
path: root/node.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-03-03 14:30:48 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-03-03 14:30:48 -0500
commitd5488ef5c47878e04045a91d204cf1ccbdd9cd05 (patch)
tree23d11ed78e0cf33776f810e285aada539c4f1f28 /node.c
parentc59429d28718c1aae581f023d33466580118b0fc (diff)
:tab-move-left/right
Diffstat (limited to 'node.c')
-rw-r--r--node.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/node.c b/node.c
index 4f06bce..be4e676 100644
--- a/node.c
+++ b/node.c
@@ -27,6 +27,16 @@ static void node_tab_switch(Ted *ted, Node *node, i64 tab) {
}
}
+// swap the position of two tabs
+static void node_tabs_swap(Node *node, u16 tab1, u16 tab2) {
+ assert(tab1 < arr_len(node->tabs) && tab2 < arr_len(node->tabs));
+ if (node->active_tab == tab1) node->active_tab = tab2;
+ else if (node->active_tab == tab2) node->active_tab = tab1;
+ u16 tmp = node->tabs[tab1];
+ node->tabs[tab1] = node->tabs[tab2];
+ node->tabs[tab2] = tmp;
+}
+
static void node_free(Node *node) {
arr_free(node->tabs);
memset(node, 0, sizeof *node);