diff options
author | pommicket <pommicket@gmail.com> | 2023-08-15 17:07:59 -0300 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-08-15 17:24:36 -0300 |
commit | da57a4738f0d447d9c8bf322c486de6b3e177c48 (patch) | |
tree | 02296a64b5574153fee50fc57c9a021e98cad965 /ted.c | |
parent | 87845777777058fa45c93df15e67b65ad41708a7 (diff) |
fix node bug2.5
Diffstat (limited to 'ted.c')
-rw-r--r-- | ted.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -449,6 +449,9 @@ static Node *ted_buffer_location_in_node_tree(Ted *ted, TextBuffer *buffer, u16 } void ted_switch_to_buffer(Ted *ted, TextBuffer *buffer) { + if (buffer == ted->active_buffer) + return; + TextBuffer *search_buffer = find_search_buffer(ted); ted->active_buffer = buffer; autocomplete_close(ted); @@ -516,6 +519,7 @@ void ted_node_switch(Ted *ted, Node *node) { while (node_child1(node)) { node = node_child1(node); } + ted->active_node = node; ted_switch_to_buffer(ted, node_get_tab(node, node_active_tab(node))); } @@ -527,7 +531,7 @@ static TextBuffer *ted_open_buffer(Ted *ted, u16 *tab) { if (!node) { if (!arr_len(ted->nodes)) { // no nodes open; create a root node - node = ted->active_node = node_new(ted); + node = node_new(ted); } else if (ted->prev_active_buffer) { // opening a file while a menu is open // it may happen.... (currently happens for rename symbol) @@ -548,6 +552,9 @@ static TextBuffer *ted_open_buffer(Ted *ted, u16 *tab) { u16 active_tab = (u16)(node_tab_count(node) - 1); *tab = active_tab; node_tab_switch(ted, node, active_tab); + ted->active_node = node; + ted->active_buffer = new_buffer; + return new_buffer; } |