Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 2 additions & 2 deletions libs/terminal_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚑ Quick win

Esc hint is dropped whenever custom help text is provided.

The current fallback logic keeps "Esc to cancel" only when help_text is empty. For prompts that pass custom help text, cancellation discoverability is still missing.

Suggested fix
-        footer = help_text or 'Use Up/Down arrows and Enter to select. Esc to cancel.'
+        base_help = help_text or 'Use Up/Down arrows and Enter to select.'
+        footer = base_help if 'esc' in base_help.lower() else f'{base_help} Esc to cancel.'
πŸ€– Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/terminal_ui.py` at line 70, The footer assignment at line 70 uses a
simple or operator that causes the "Esc to cancel" hint to be completely dropped
when custom help_text is provided. Modify the logic to ensure that whenever a
footer is displayed, it always includes the cancellation hint. Either append the
"Esc to cancel" text to any provided help_text, or construct the footer by
combining the help_text with the cancellation information so that users always
know they can press Esc to cancel, regardless of whether custom help text is
supplied.

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)
Expand All @@ -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:
Expand Down
Loading