fix closing tabs not showing the right content (#46)

fixes #43

Reviewed-on: https://codeberg.org/StreamGraph/StreamGraph/pulls/46
Co-authored-by: Lera Elvoé <yagich@poto.cafe>
Co-committed-by: Lera Elvoé <yagich@poto.cafe>
This commit is contained in:
Lera Elvoé 2024-01-20 04:01:26 +00:00 committed by yagich
parent b143c63dcc
commit a3ceb54c48

View file

@ -101,11 +101,11 @@ func is_empty() -> bool:
## Closes a tab at the index [param tab]. ## Closes a tab at the index [param tab].
func close_tab(tab: int) -> void: func close_tab(tab: int) -> void:
if !tab_bar.select_previous_available():
tab_bar.select_next_available()
content_container.get_child(tab).queue_free() content_container.get_child(tab).queue_free()
_tab_metadata.remove_at(tab) _tab_metadata.remove_at(tab)
tab_bar.remove_tab(tab) tab_bar.remove_tab(tab)
if !tab_bar.select_previous_available():
tab_bar.select_next_available()
tab_closed.emit(tab) tab_closed.emit(tab)
if tab_bar.tab_count == 0: if tab_bar.tab_count == 0:
_previous_active_tab = -1 _previous_active_tab = -1