🎨 Palette: [UX improvement] Enhance TUI usability and prevent keyboard traps#61
🎨 Palette: [UX improvement] Enhance TUI usability and prevent keyboard traps#61haseeb-heaven wants to merge 1 commit into
Conversation
…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
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
📝 WalkthroughWalkthroughThis 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 ChangesSelection Interface Enhancements
🎯 2 (Simple) | ⏱️ ~8 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
libs/terminal_ui.py (1)
79-81: 💤 Low valueConsider escaping option text and preserving prior
show_choices=Falsesemantics.Two small concerns with the formatted prompt:
- If any option contains Rich markup characters (e.g.
[,]),Prompt.askwill try to interpret them as markup and may render unexpectedly or raise. Worth passing the prompt throughrich.markup.escapeor constructing it defensively, sinceoptionsforselect_modelcomes fromlist_available_models()and model names can contain brackets/colons.- Dropping the
choices=argument meansPrompt.askwill no longer re-prompt on invalid input — a non-TTY caller piping an unrelated string now silently falls through todefault_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
📒 Files selected for processing (2)
.Jules/palette.mdlibs/terminal_ui.py
💡 What: Improved TUI help hints and navigation controls for terminal environments. Added explicit instructions to cancel (Esc/Ctrl-C), mapped the
\x03interrupt 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
New Features