summaryrefslogtreecommitdiff
path: root/command.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 /command.c
parentc59429d28718c1aae581f023d33466580118b0fc (diff)
:tab-move-left/right
Diffstat (limited to 'command.c')
-rw-r--r--command.c17
1 files changed, 13 insertions, 4 deletions
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);