Skip to content

Comments

fix(tui): graceful exit on Ctrl+C and resolve multiline paste corruption#14440

Open
n24q02m wants to merge 1 commit intoanomalyco:devfrom
n24q02m:fix/tui-bugs
Open

fix(tui): graceful exit on Ctrl+C and resolve multiline paste corruption#14440
n24q02m wants to merge 1 commit intoanomalyco:devfrom
n24q02m:fix/tui-bugs

Conversation

@n24q02m
Copy link

@n24q02m n24q02m commented Feb 20, 2026

Issue for this PR

Closes #11826
Closes #10975

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

  1. Graceful Exit: Resolves the zombie process issue when closing the TUI. By adding a fallback process.exit(0) after standard renderer and event loop cleanup, the application will forcefully exit if background processes (like file watchers or MCP servers) are blocking a clean exit.
  2. Multiline Paste: Fixes UI corruption and data loss that occurred when pasting large text. Previously, the system generated an extmark [Pasted ~X lines] but didn't actually insert the text into the internal buffer. Now, the raw text is directly inserted via input.insertText().

How did you verify your code works?

Pasted >150 lines of text successfully without UI corruption. Pressed Ctrl+C and confirmed the terminal exits immediately without leaving orphaned processes. Ran bun run typecheck and bun run test.

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Feb 20, 2026
@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one potentially related PR:

#13848 - fix(tui): add signal handlers to prevent orphaned processes on terminal close

This PR appears to address a similar issue with graceful process cleanup and preventing orphaned/zombie processes on terminal close. It may overlap with the Ctrl+C graceful exit handling in PR #14440.

All other search results either returned PR #14440 itself or addressed different concerns (MCP server processes, ANSI color codes, memory leaks, etc.).

@github-actions github-actions bot removed needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Feb 20, 2026
@github-actions
Copy link
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

Ctrl-C Bug Report [FEATURE]: Can use ctrl+c twice to close the tui?

1 participant