From d5488ef5c47878e04045a91d204cf1ccbdd9cd05 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Wed, 3 Mar 2021 14:30:48 -0500 Subject: :tab-move-left/right --- command.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'command.c') diff --git a/command.c b/command.c index 9470dc0..c7276ac 100644 --- a/command.c +++ b/command.c @@ -268,15 +268,24 @@ void command_execute(Ted *ted, Command c, i64 argument) { } } break; case CMD_TAB_NEXT: - if (ted->active_node) node_tab_next(ted, ted->active_node, argument); + if (node) node_tab_next(ted, node, argument); break; case CMD_TAB_PREV: - if (ted->active_node) node_tab_prev(ted, ted->active_node, argument); + if (node) node_tab_prev(ted, node, argument); break; case CMD_TAB_SWITCH: - if (ted->active_node) node_tab_switch(ted, ted->active_node, argument); + if (node) node_tab_switch(ted, node, argument); break; - + case CMD_TAB_MOVE_LEFT: { + u16 active_tab = node->active_tab; + if (active_tab > 0) + node_tabs_swap(node, active_tab, active_tab - 1); + } break; + case CMD_TAB_MOVE_RIGHT: { + u16 active_tab = node->active_tab; + if (active_tab + 1 < arr_len(node->tabs)) + node_tabs_swap(node, active_tab, active_tab + 1); + } break; case CMD_FIND: if (buffer) find_open(ted, false); -- cgit v1.2.3