From eb80e99fa30c662708b4d40a4dfd6bb1befebda9 Mon Sep 17 00:00:00 2001 From: haseeb-heaven <11544739+haseeb-heaven@users.noreply.github.com> Date: Mon, 15 Jun 2026 12:01:52 +0000 Subject: [PATCH] Palette: Add explicit cancellation hint and option visibility in TUI prompts --- .jules/palette.md | 3 +++ libs/terminal_ui.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .jules/palette.md diff --git a/.jules/palette.md b/.jules/palette.md new file mode 100644 index 0000000..4b44f87 --- /dev/null +++ b/.jules/palette.md @@ -0,0 +1,3 @@ +## 2025-06-15 - Explicit Shortcut Hints in TUI +**Learning:** Users in terminal environments often lack clear discoverability for standard escape actions compared to web UIs. Implicit knowledge like "Esc cancels" shouldn't be assumed. +**Action:** Always append explicit cancellation shortcuts (e.g., 'Esc to cancel') in terminal UI prompt footers. diff --git a/libs/terminal_ui.py b/libs/terminal_ui.py index 47b8b3b..ee8f1f2 100644 --- a/libs/terminal_ui.py +++ b/libs/terminal_ui.py @@ -67,7 +67,7 @@ def _render_selector(self, title, options, selected_index, help_text, default): style = 'bold green' if index == selected_index else '' table.add_row(marker, label, style=style) - footer = help_text or 'Use Up/Down arrows and Enter to select.' + footer = help_text or 'Use Up/Down arrows and Enter to select. Esc to cancel.' self.console.print(Panel.fit(footer, title='Interpreter TUI', border_style='green')) self.console.print(f"[bold cyan]{title}[/bold cyan]") self.console.print(table) @@ -76,7 +76,7 @@ def _render_selector(self, title, options, selected_index, help_text, default): def _select_option(self, title, options, default, help_text=None): if not sys.stdin.isatty(): default_choice = default if default in options else options[0] - answer = Prompt.ask(f"{title}", default=default_choice).strip() + answer = Prompt.ask(f"{title} \\[{'|'.join(options)}]", default=default_choice).strip() if answer in options: return answer for option in options: