Skip to content

🎨 Palette: [UX improvement] Support Ctrl-C and add exit hints in TUI#91

Open
haseeb-heaven wants to merge 1 commit into
mainfrom
palette/tui-ctrl-c-ux-7164315739090522758
Open

🎨 Palette: [UX improvement] Support Ctrl-C and add exit hints in TUI#91
haseeb-heaven wants to merge 1 commit into
mainfrom
palette/tui-ctrl-c-ux-7164315739090522758

Conversation

@haseeb-heaven

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

Copy link
Copy Markdown
Owner

💡 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

    • Added guidance on handling terminal keyboard interrupts to prevent input traps.
  • Bug Fixes

    • Terminal selection operations now properly cancel when Ctrl-C is pressed.
    • Updated help prompts to indicate Esc or Ctrl-C can cancel operations.

@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 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The 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 KeyboardInterrupt with a user-friendly message. The footer hint is updated to document this capability, and the pattern is recorded in the project palette.

Changes

Terminal UI Ctrl-C Interrupt Handling

Layer / File(s) Summary
Ctrl-C interrupt handling and UI documentation
libs/terminal_ui.py, .jules/palette.md
_select_option now maps Ctrl-C (\x03) to the same cancellation path as escape, raising KeyboardInterrupt. _render_selector footer is updated to explicitly document "Esc/Ctrl-C to cancel" for users. Palette entry documents the terminal raw-mode interrupt handling pattern.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A rabbit hops through terminal keys,
Ctrl-C now sets the UI free,
No more traps in raw-mode night,
The footer hints shine clear and bright! 🐰✨

🚥 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 directly addresses the main changes: adding Ctrl-C support and exit hints in the terminal UI. It accurately summarizes the primary improvements in the changeset.
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/tui-ctrl-c-ux-7164315739090522758

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.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2a47494 and 6083bb1.

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

Comment thread libs/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.'

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

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.

Suggested change
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).

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