🎨 Palette: [UX improvement] Support Ctrl-C and add exit hints in TUI#91
🎨 Palette: [UX improvement] Support Ctrl-C and add exit hints in TUI#91haseeb-heaven wants to merge 1 commit into
Conversation
|
👋 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.
📝 WalkthroughWalkthroughThe PR adds Ctrl-C interrupt support to the terminal UI selector. When users press Ctrl-C in the terminal interface, it now triggers the same cancellation path as the Escape key, raising ChangesTerminal UI Ctrl-C Interrupt Handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 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.
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 70: The footer currently replaces the cancel hint when help_text is
provided; change the logic so the cancel hint is always appended: create a
shared cancel suffix string (e.g., CANCEL_SUFFIX = 'Esc/Ctrl-C to cancel.') and
build footer by combining help_text (if any) with the suffix, e.g., footer =
f"{help_text} {CANCEL_SUFFIX}" when help_text is truthy or footer =
CANCEL_SUFFIX when not; ensure you use the existing footer and help_text symbols
in libs/terminal_ui.py and avoid duplicating the suffix if help_text already
ends with it (trim or check before appending).
🪄 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: 7c10bea8-27c5-4bb5-b5f5-b87927d9b9f5
📒 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. Esc/Ctrl-C to cancel.' |
There was a problem hiding this comment.
Always append cancel shortcuts to custom help text.
When help_text is provided, the footer no longer shows Esc/Ctrl-C to cancel, so discoverability is inconsistent across prompts. Consider appending a shared cancel suffix instead of replacing the entire footer.
💡 Suggested patch
- footer = help_text or 'Use Up/Down arrows and Enter to select. Esc/Ctrl-C to cancel.'
+ base_hint = 'Esc/Ctrl-C to cancel.'
+ footer = f"{help_text} {base_hint}" if help_text else f"Use Up/Down arrows and Enter to select. {base_hint}"📝 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. Esc/Ctrl-C to cancel.' | |
| base_hint = 'Esc/Ctrl-C to cancel.' | |
| footer = f"{help_text} {base_hint}" if help_text else f"Use Up/Down arrows and Enter to select. {base_hint}" |
🤖 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 currently replaces the cancel
hint when help_text is provided; change the logic so the cancel hint is always
appended: create a shared cancel suffix string (e.g., CANCEL_SUFFIX =
'Esc/Ctrl-C to cancel.') and build footer by combining help_text (if any) with
the suffix, e.g., footer = f"{help_text} {CANCEL_SUFFIX}" when help_text is
truthy or footer = CANCEL_SUFFIX when not; ensure you use the existing footer
and help_text symbols in libs/terminal_ui.py and avoid duplicating the suffix if
help_text already ends with it (trim or check before appending).
💡 What: Added support for Ctrl-C (
\x03) to exit TUI selection prompts and updated the footer text to explicitly mention "Esc/Ctrl-C to cancel".🎯 Why: Users expect Ctrl-C to cancel terminal prompts. Previously, pressing Ctrl-C in raw mode did nothing, trapping users unless they guessed to press Escape. The added text improves discoverability.
📸 Before/After: N/A
♿ Accessibility: Prevents a keyboard trap in terminal UI raw mode, making the interface more predictable and user-friendly for keyboard users.
PR created automatically by Jules for task 7164315739090522758 started by @haseeb-heaven
Summary by CodeRabbit
Documentation
Bug Fixes