diff --git a/biscuit/core/layout/base/content/editors/__init__.py b/biscuit/core/layout/base/content/editors/__init__.py index a0037e28..e8f89533 100644 --- a/biscuit/core/layout/base/content/editors/__init__.py +++ b/biscuit/core/layout/base/content/editors/__init__.py @@ -113,6 +113,8 @@ def reopen_editor(self, path: str): def open_editor(self, path: str, exists: bool=True) -> Editor | BaseEditor: "open Editor with path and exists values passed" + if self.is_open(path): + return self.tabs.switch_tabs(path) if path in self.closed_editors: return self.add_editor(self.closed_editors[path]) return self.add_editor(Editor(self, path, exists)) diff --git a/biscuit/core/layout/base/content/editors/tabs.py b/biscuit/core/layout/base/content/editors/tabs.py index 8a907edb..885efaae 100644 --- a/biscuit/core/layout/base/content/editors/tabs.py +++ b/biscuit/core/layout/base/content/editors/tabs.py @@ -74,3 +74,9 @@ def clear_all_tabs(self) -> None: tab.destroy() self.tabs.clear() + + def switch_tabs(self, path) -> None: + for tab in self.tabs: + if tab.editor.path == path: + tab.select() + return tab.editor