From 8fe366e04191972a855165021157044e097109c4 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Thu, 7 May 2026 19:30:45 -0400 Subject: [PATCH] fix(external-editor): Fix TextEditorConfig parsing and add error handling - TextEditorConfig.from_dict no longer requires 'name' field since name comes from dict key - Added try/except around _render_external_editor_panel to prevent tab bar mismatch --- src/gui_2.py | 5 ++++- src/models.py | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui_2.py b/src/gui_2.py index a5aa0e1..4330a21 100644 --- a/src/gui_2.py +++ b/src/gui_2.py @@ -974,7 +974,10 @@ class App: self._render_external_tools_panel() imgui.separator() imgui.text("") - self._render_external_editor_panel() + try: + self._render_external_editor_panel() + except Exception as e: + imgui.text_colored(vec4(1, 0.3, 0.3, 1), f"Error: {str(e)}") imgui.end_tab_item() if imgui.begin_tab_item("Workspace Layouts")[0]: imgui.text("Experimental: Auto-switch layout by Tier") diff --git a/src/models.py b/src/models.py index c96933a..d7813b0 100644 --- a/src/models.py +++ b/src/models.py @@ -425,7 +425,11 @@ class ExternalEditorConfig: editors = {} for name, ed_data in data.get("editors", {}).items(): if isinstance(ed_data, dict): - editors[name] = TextEditorConfig.from_dict(ed_data) + editors[name] = TextEditorConfig( + name=name, + path=ed_data.get("path", ""), + diff_args=ed_data.get("diff_args", []), + ) elif isinstance(ed_data, str): editors[name] = TextEditorConfig(name=name, path=ed_data) return cls(