diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2021-02-24 11:32:20 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2021-02-24 11:32:20 -0500 |
commit | 4aa02183b7f317ca1183b4d3e58ec9da166479d6 (patch) | |
tree | 6c03bb12002a4ca9c2f48620fa2a704c41e756de /command.c | |
parent | c101b231458da51767a79fb4b92304b1c76ef5e9 (diff) |
big bugfixes
update active_tab properly when a tab is closed, fix Ctrl+O with no buffers open
Diffstat (limited to 'command.c')
-rw-r--r-- | command.c | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -19,6 +19,7 @@ char const *command_to_str(Command c) { void command_execute(Ted *ted, Command c, i64 argument) { TextBuffer *buffer = ted->active_buffer; + Node *node = ted->active_node; Settings *settings = &ted->settings; @@ -239,7 +240,6 @@ void command_execute(Ted *ted, Command c, i64 argument) { if (ted->menu) { menu_close(ted); } else { - Node *node = ted->active_node; if (node) { u16 tab_idx = node->active_tab; buffer = &ted->buffers[node->tabs[tab_idx]]; @@ -307,5 +307,23 @@ void command_execute(Ted *ted, Command c, i64 argument) { case CMD_GOTO_LINE: menu_open(ted, MENU_GOTO_LINE); break; + + case CMD_SPLIT_HORIZONTAL: + case CMD_SPLIT_VERTICAL: + +#if 0 + if (node) { + if (arr_len(node->tabs) > 1) { // need at least 2 tabs to split + i32 left_idx = ted_new_node(ted); + i32 right_idx = ted_new_node(ted); + if (left >= 0 && right >= 0) { + Node *left = &ted->nodes[left_idx]; + Node *right = &ted->nodes[right_idx]; + arr_add(right->tabs, ) + } + } + } + #endif + break; } } |