diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2021-03-03 14:30:48 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2021-03-03 14:30:48 -0500 |
commit | d5488ef5c47878e04045a91d204cf1ccbdd9cd05 (patch) | |
tree | 23d11ed78e0cf33776f810e285aada539c4f1f28 /node.c | |
parent | c59429d28718c1aae581f023d33466580118b0fc (diff) |
:tab-move-left/right
Diffstat (limited to 'node.c')
-rw-r--r-- | node.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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); |