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: