Skip to content

Refactor TUI exit keybindings: Ctrl+D to quit and Enter to exit after render#103

Merged
tjazerzen merged 3 commits intomainfrom
feature/ctrl-d-exit
Feb 13, 2026
Merged

Refactor TUI exit keybindings: Ctrl+D to quit and Enter to exit after render#103
tjazerzen merged 3 commits intomainfrom
feature/ctrl-d-exit

Conversation

@tjazerzen
Copy link
Contributor

@tjazerzen tjazerzen commented Feb 13, 2026

Summary

  • Simplified exit behavior by using Ctrl+D for immediate exit
  • Changed Ctrl+C to only copy selected text (does nothing without selection)
  • Removed the double Ctrl+C to quit logic and associated quit-pending state
  • Added Enter key to exit TUI after rendering completes
  • Footer dynamically updates to show render-finished keybindings

Changes

Keyboard Shortcuts

  • Ctrl+C: Now only copies selected text; does nothing if no text is selected
  • Ctrl+D: New keybinding for immediate exit without confirmation
  • Enter: Exits the TUI after rendering has finished
  • Removed: Double Ctrl+C to quit workflow
  • Removed: ESC to cancel quit

Visual changes

image

Code Changes

  • tui/plain2code_tui.py:

    • Updated keybindings (Ctrl+C → copy_selection, Ctrl+D → quit, Enter → enter_exit)
    • Removed _quit_pending state management
    • Replaced action_smart_quit() with simpler action_copy_selection()
    • Added action_enter_exit() to allow exiting with Enter after render completes
    • Added _render_finished flag to track render completion state
    • Updated on_render_completed() to set flag and update footer
    • Removed action_cancel_quit() and _refresh_footer() methods
  • tui/components.py:

    • Updated footer text to show new keybindings
    • Added RENDER_FINISHED_TEXT constant for post-render footer
    • Added show_render_finished() method to dynamically update footer
    • Removed quit-pending state management from CustomFooter
    • Simplified component by removing update_quit_state() method
  • tui/widget_helpers.py:

    • Updated success message from "(ctrl+c to exit)" to "(enter to exit)"
  • tui/styles.css:

    • Removed unused .custom-footer-quit-pending CSS class

Test Plan

  • Verify Ctrl+C copies selected text in the TUI
  • Verify Ctrl+C does nothing when no text is selected
  • Verify Ctrl+D exits the TUI immediately
  • Verify Enter does nothing during rendering
  • Verify Enter exits the TUI after rendering completes
  • Verify footer updates from "ctrl+d: quit" to "enter: exit" after render finishes
  • Verify footer displays correct keybindings

🤖 Generated with Claude Code

tjazerzen and others added 2 commits February 13, 2026 11:09
- Changed Ctrl+C to only copy selected text (does nothing if no selection)
- Added Ctrl+D for immediate exit without confirmation
- Removed double Ctrl+C to quit logic and quit-pending state
- Removed ESC to cancel quit logic
- Updated footer and success messages to reflect new keybindings
- Cleaned up unused CSS class for quit-pending state

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Update footer to show render-finished keybindings and allow
exiting with Enter once rendering is done.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Changed Ctrl+C to only copy selected text (does nothing if no selection)
- Added Ctrl+D for immediate exit without confirmation
- Removed double Ctrl+C to quit logic and quit-pending state
- Removed ESC to cancel quit logic
- Updated footer and success messages to reflect new keybindings
- Cleaned up unused CSS class for quit-pending state

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@tjazerzen tjazerzen changed the title Refactor TUI exit keybinding: use Ctrl+D instead of double Ctrl+C Refactor TUI exit keybindings: Ctrl+D to quit and Enter to exit after render Feb 13, 2026
@tjazerzen tjazerzen requested a review from zanjonke February 13, 2026 13:25
Copy link
Contributor

@zanjonke zanjonke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@tjazerzen tjazerzen merged commit 0cd121f into main Feb 13, 2026
10 checks passed
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.

2 participants