🎨 Palette: Add TUI Keyboard Traps and Prompt Choices#187
Conversation
💡 What: Added explicit prompt choices when running in non-TTY mode, added a `Ctrl-C to cancel` indicator in TUI selector panel, and fixed a keyboard trap where `Ctrl-C` would be read natively without triggering `KeyboardInterrupt` in raw mode. 🎯 Why: To ensure users are not locked in raw terminal mode when standard abort keys are used, and to show explicit valid options for configuration inputs. 📸 Before/After: Visual hints added for cancelability. ♿ Accessibility: Preventing keyboard traps is a critical a11y consideration; ensuring users have a visible exit path and the TUI handles standard interrupt sequences.
|
👋 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
📝 WalkthroughWalkthroughAdds explicit Ctrl-C ( ChangesCtrl-C Cancellation Handling
Estimated code review effort: 1 (Trivial) | ~5 minutes Related issues: None specified. Related PRs: None specified. Suggested labels: bug, enhancement, documentation Suggested reviewers: haseeb-heaven 🐰 A Ctrl-C tap, no longer trapped in text, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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.
Actionable comments posted: 1
🤖 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 `@libs/terminal_ui.py`:
- Line 74: The footer in the terminal selection helper currently drops the
Ctrl-C cancel hint whenever `help_text` is provided. Update the footer
construction in `libs/terminal_ui.py` so the cancel hint is always appended, and
make sure the callers like `_select_boolean` and `select_model` still show their
custom help text plus the Ctrl-C guidance. Keep the change centered around the
footer logic used by the selection prompt functions.
🪄 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: 396e7d43-71a3-4353-a8fa-7bfd18240cbe
📒 Files selected for processing (2)
.jules/palette.mdlibs/terminal_ui.py
| 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. Ctrl-C to cancel.' |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Ctrl-C hint is lost whenever callers pass an explicit help_text.
The new "Ctrl-C to cancel" text is only used as a fallback when help_text is falsy. But _select_boolean (line 118) and select_model (line 129) always pass their own explicit help_text strings that don't mention Ctrl-C, so those screens — a large fraction of all prompts shown by interactive_settings/launch — never surface the cancellation hint this PR is meant to add. Only select_mode/select_language (which pass no help_text) benefit from the new default.
Consider always appending the Ctrl-C hint regardless of whether a custom help_text was supplied.
💡 Proposed fix
- footer = help_text or 'Use Up/Down arrows and Enter to select. Ctrl-C to cancel.'
+ base_footer = help_text or 'Use Up/Down arrows and Enter to select.'
+ footer = f'{base_footer} Ctrl-C to cancel.' if 'Ctrl-C' not in base_footer else base_footer📝 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.
| footer = help_text or 'Use Up/Down arrows and Enter to select. Ctrl-C to cancel.' | |
| base_footer = help_text or 'Use Up/Down arrows and Enter to select.' | |
| footer = f'{base_footer} Ctrl-C to cancel.' if 'Ctrl-C' not in base_footer else base_footer |
🤖 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 74, The footer in the terminal selection helper
currently drops the Ctrl-C cancel hint whenever `help_text` is provided. Update
the footer construction in `libs/terminal_ui.py` so the cancel hint is always
appended, and make sure the callers like `_select_boolean` and `select_model`
still show their custom help text plus the Ctrl-C guidance. Keep the change
centered around the footer logic used by the selection prompt functions.
🎨 Palette: Add TUI Keyboard Traps and Prompt Choices
💡 What: Added explicit prompt choices when running in non-TTY mode, added a
Ctrl-C to cancelindicator in TUI selector panel, and fixed a keyboard trap whereCtrl-Cwould be read natively without triggeringKeyboardInterruptin raw mode.🎯 Why: To ensure users are not locked in raw terminal mode when standard abort keys are used, and to show explicit valid options for configuration inputs.
📸 Before/After: Visual hints added for cancelability.
♿ Accessibility: Preventing keyboard traps is a critical a11y consideration; ensuring users have a visible exit path and the TUI handles standard interrupt sequences.
PR created automatically by Jules for task 13538077490241913394 started by @haseeb-heaven
Summary by CodeRabbit