🎨 Palette: [UX improvement] Improve TUI interactive hints and controls#98
🎨 Palette: [UX improvement] Improve TUI interactive hints and controls#98haseeb-heaven wants to merge 1 commit into
Conversation
This commit improves discoverability and keyboard accessibility for the Terminal UI. 1. Adds explicit `Esc/Ctrl-C` shortcut hints in the TUI selector footer. 2. Formats options inside standard text prompts (`Prompt.ask`) to explicitly show available inputs. 3. Catch standard terminal interrupt byte (`\x03`) to ensure clean exits when in raw termios 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. |
📝 WalkthroughWalkthroughThe PR improves terminal UI keyboard handling in the selector by accepting both Escape and Ctrl-C for cancellation, updates the help text and prompt to make shortcuts discoverable, and documents the keyboard trap prevention approach. ChangesTerminal UI Keyboard Handling and Accessibility
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 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.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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.
Inline comments:
In @.jules/palette.md:
- Line 1: Update the markdown header date from "## 2024-06-02 - TUI Keyboard
Traps and Discoverability" to "## 2026-06-02 - TUI Keyboard Traps and
Discoverability" in the .jules/palette.md file so the entry reflects the PR
creation date; locate the header line containing "TUI Keyboard Traps and
Discoverability" and correct the year only.
In `@libs/terminal_ui.py`:
- Line 80: The prompt construction in Prompt.ask currently uses an escaped
bracket ("\\[") which renders a literal backslash; update the Prompt.ask call
(where answer is assigned) to build the prompt string with a normal opening
bracket "[" (e.g., f"{title} [{'|'.join(options)}]") so the displayed prompt
shows "Mode [code|chat|script]" instead of "Mode \[code|chat|script]"; keep
default=default_choice and .strip() as-is.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5713ecf0-cfcc-4e34-8495-8e20e4e986c1
📒 Files selected for processing (2)
.jules/palette.mdlibs/terminal_ui.py
| @@ -0,0 +1,3 @@ | |||
| ## 2024-06-02 - TUI Keyboard Traps and Discoverability | |||
There was a problem hiding this comment.
Correct the year in the date header.
The entry is dated 2024-06-02, but the PR was created on 2026-06-02. This appears to be a typo.
📅 Proposed fix
-## 2024-06-02 - TUI Keyboard Traps and Discoverability
+## 2026-06-02 - TUI Keyboard Traps and Discoverability📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ## 2024-06-02 - TUI Keyboard Traps and Discoverability | |
| ## 2026-06-02 - TUI Keyboard Traps and Discoverability |
🤖 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 @.jules/palette.md at line 1, Update the markdown header date from "##
2024-06-02 - TUI Keyboard Traps and Discoverability" to "## 2026-06-02 - TUI
Keyboard Traps and Discoverability" in the .jules/palette.md file so the entry
reflects the PR creation date; locate the header line containing "TUI Keyboard
Traps and Discoverability" and correct the year only.
| 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() |
There was a problem hiding this comment.
Fix the escaped bracket in the prompt format.
The \\[ will display as a literal backslash followed by a bracket (\[) instead of just a bracket ([). This results in incorrect prompt text like Mode \[code|chat|script] instead of Mode [code|chat|script].
🐛 Proposed fix
- answer = Prompt.ask(f"{title} \\[{'|'.join(options)}]", default=default_choice).strip()
+ answer = Prompt.ask(f"{title} [{'|'.join(options)}]", default=default_choice).strip()📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| answer = Prompt.ask(f"{title} \\[{'|'.join(options)}]", default=default_choice).strip() | |
| answer = Prompt.ask(f"{title} [{'|'.join(options)}]", default=default_choice).strip() |
🤖 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 80, The prompt construction in Prompt.ask
currently uses an escaped bracket ("\\[") which renders a literal backslash;
update the Prompt.ask call (where answer is assigned) to build the prompt string
with a normal opening bracket "[" (e.g., f"{title} [{'|'.join(options)}]") so
the displayed prompt shows "Mode [code|chat|script]" instead of "Mode
\[code|chat|script]"; keep default=default_choice and .strip() as-is.
💡 What
Esc/Ctrl-C to cancelhints to the TUI interaction footer.[options]).Ctrl-Cbyte (\x03) in raw keyboard input loops, raising a clean KeyboardInterrupt.🎯 Why
richprompts fallback to text, hiding valid input options leads to frustrating trial-and-error. Explicitly rendering[opt1|opt2]solves this.📸 Before/After
(Esc/Ctrl-C to cancel)permanently rendered in the prompt panel.♿ Accessibility
PR created automatically by Jules for task 9262072439929030398 started by @haseeb-heaven
Summary by CodeRabbit