Skip to content

🎨 Palette: [UX improvement] Enhance TUI usability and prevent keyboard traps#61

Open
haseeb-heaven wants to merge 1 commit into
mainfrom
palette/micro-ux-tui-improvements-620634921724041251
Open

🎨 Palette: [UX improvement] Enhance TUI usability and prevent keyboard traps#61
haseeb-heaven wants to merge 1 commit into
mainfrom
palette/micro-ux-tui-improvements-620634921724041251

Conversation

@haseeb-heaven

@haseeb-heaven haseeb-heaven commented May 21, 2026

Copy link
Copy Markdown
Owner

💡 What: Improved TUI help hints and navigation controls for terminal environments. Added explicit instructions to cancel (Esc/Ctrl-C), mapped the \x03 interrupt byte to the cancellation logic properly to prevent keyboard traps, and explicitly provided the available choices visually in the fallback prompts without breaking existing case insensitivity.

🎯 Why: To make the terminal interface more intuitive and prevent situations where users get stuck in input loops without knowing how to exit.

📸 Before/After: Visual hints added to prompts and TUI footers.

♿ Accessibility: Added clear navigation and cancellation hints, and prevented keyboard trap behavior in TUI selection lists.


PR created automatically by Jules for task 620634921724041251 started by @haseeb-heaven

Summary by CodeRabbit

  • Documentation

    • Added guidance on prompt choice parameter behavior and custom formatting options.
  • New Features

    • Selection interface now clearly displays available options in the prompt.
    • Added Ctrl-C as an alternative cancellation method alongside the Escape key.
    • Enhanced footer text with clearer cancellation instructions.

Review Change Stack

…d traps

- Display available prompt choices explicitly in non-TTY mode
- Update default help hint to explain escape shortcuts
- Map Ctrl-C (\x03) to exit gracefully during interactive raw mode
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This pull request enhances the interactive selection interface with improved user guidance and expands cancellation support. The footer now explicitly mentions Ctrl-C alongside Esc, available choices are formatted into the prompt, and the cancellation handler recognizes both escape and Ctrl-C. Documentation clarifies rich's strict case-sensitive prompt matching and provides a workaround.

Changes

Selection Interface Enhancements

Layer / File(s) Summary
Selection UI and prompt behavior documentation
.Jules/palette.md, libs/terminal_ui.py
Footer help text expanded to show "Esc/Ctrl-C to cancel". Available options formatted as /-separated string in prompt display. Selection cancellation handler extended to trigger on both escape key and \x03 (Ctrl-C). Documentation note added explaining rich Prompt's case-sensitive choices parameter behavior and providing a manual formatting workaround.

🎯 2 (Simple) | ⏱️ ~8 minutes

A rabbit hops through the prompt so fine,
With hints and choices, all in line,
Esc and Ctrl-C both cancel the dance,
Case-sensitive wisdom for every chance,
Selection flows smooth, what a delight! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title references enhancing TUI usability and preventing keyboard traps, which aligns with the main changes: improved terminal help hints, cancellation handling (Esc/Ctrl-C), and accessibility improvements in the TUI selector.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch palette/micro-ux-tui-improvements-620634921724041251

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (1)
libs/terminal_ui.py (1)

79-81: 💤 Low value

Consider escaping option text and preserving prior show_choices=False semantics.

Two small concerns with the formatted prompt:

  1. If any option contains Rich markup characters (e.g. [, ]), Prompt.ask will try to interpret them as markup and may render unexpectedly or raise. Worth passing the prompt through rich.markup.escape or constructing it defensively, since options for select_model comes from list_available_models() and model names can contain brackets/colons.
  2. Dropping the choices= argument means Prompt.ask will no longer re-prompt on invalid input — a non-TTY caller piping an unrelated string now silently falls through to default_choice. That is intentional per the doc note, but worth confirming it matches the desired UX (vs. e.g. logging a warning when the input doesn't match any option).
🤖 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` around lines 79 - 81, Escape title and option text for
display using rich.markup.escape and restore Prompt.ask's validation by
re-adding the choices/show_choices arguments: build a display string with
escaped options (e.g., escaped_choices_str = "/".join(escape(opt) for opt in
options) and escaped_title = escape(title)), then call
Prompt.ask(f"{escaped_title} [{escaped_choices_str}]", choices=options,
show_choices=False, default=default_choice) so model names with brackets/colons
don't trigger markup rendering but input is still validated (affecting
select_model and list_available_models flows).
🤖 Prompt for all review comments with 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.

Nitpick comments:
In `@libs/terminal_ui.py`:
- Around line 79-81: Escape title and option text for display using
rich.markup.escape and restore Prompt.ask's validation by re-adding the
choices/show_choices arguments: build a display string with escaped options
(e.g., escaped_choices_str = "/".join(escape(opt) for opt in options) and
escaped_title = escape(title)), then call Prompt.ask(f"{escaped_title}
[{escaped_choices_str}]", choices=options, show_choices=False,
default=default_choice) so model names with brackets/colons don't trigger markup
rendering but input is still validated (affecting select_model and
list_available_models flows).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2bd0cf8b-6655-46ef-870b-b0998248e13a

📥 Commits

Reviewing files that changed from the base of the PR and between 2a47494 and 86f6963.

📒 Files selected for processing (2)
  • .Jules/palette.md
  • libs/terminal_ui.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant