fix(gui): Gen+Send and MD Only with empty context no-op silently
ROOT CAUSE: 3 mismatched names in the empty-context warning path: 1. _handle_generate_send set self.show_empty_context_warning_modal = True but render_empty_context_modal checks self.show_empty_context_modal. The modal never opened. 2. _handle_generate_send / _handle_md_only never set self._pending_generation_action, so the modal's 'Proceed Anyway' button always saw None and dispatched nothing. 3. After Proceed Anyway, _pending_generation_action was never reset, so subsequent empty-context calls would dispatch the wrong action. FIX: - gui_2.py:494,501: show_empty_context_warning_modal -> show_empty_context_modal - gui_2.py:494,501: set _pending_generation_action before showing modal - gui_2.py:5385: reset _pending_generation_action = None after dispatch Tests: tests/test_gen_send_empty_context.py (5 cases) covers all 4 dispatch paths (generate/md_only x proceed/skip) plus the happy path with context. 37/37 regression pass. No new ImGui scope errors (2 pre-existing unrelated).
This commit is contained in:
+5
-2
@@ -491,14 +491,16 @@ class App:
|
||||
|
||||
def _handle_generate_send(self) -> None:
|
||||
if not self.ui_selected_context_files and not getattr(self, "_pending_proceed_generate", False):
|
||||
self.show_empty_context_warning_modal = True
|
||||
self._pending_generation_action = 'generate'
|
||||
self.show_empty_context_modal = True
|
||||
else:
|
||||
self._pending_proceed_generate = False
|
||||
self.controller._handle_generate_send()
|
||||
|
||||
def _handle_md_only(self) -> None:
|
||||
if not self.ui_selected_context_files and not getattr(self, "_pending_proceed_md_only", False):
|
||||
self.show_empty_context_warning_modal = True
|
||||
self._pending_generation_action = 'md_only'
|
||||
self.show_empty_context_modal = True
|
||||
else:
|
||||
self._pending_proceed_md_only = False
|
||||
self.controller._handle_md_only()
|
||||
@@ -5384,6 +5386,7 @@ def render_empty_context_modal(app: App) -> None:
|
||||
if imgui.button("Proceed Anyway", imgui.ImVec2(150, 0)):
|
||||
if app._pending_generation_action == 'generate': app.controller._handle_generate_send()
|
||||
elif app._pending_generation_action == 'md_only': app.controller._handle_md_only()
|
||||
app._pending_generation_action = None
|
||||
imgui.close_current_popup()
|
||||
imgui.same_line()
|
||||
if imgui.button("Cancel", imgui.ImVec2(120, 0)):
|
||||
|
||||
Reference in New Issue
Block a user