Skip to content
This repository was archived by the owner on Feb 25, 2026. It is now read-only.

fix(tui/win32): clear queued mouse input on Ctrl+C exit#609

Closed
Olusammytee wants to merge 1 commit into
Kilo-Org:devfrom
Olusammytee:fix/151-win32-flush-input-on-exit
Closed

fix(tui/win32): clear queued mouse input on Ctrl+C exit#609
Olusammytee wants to merge 1 commit into
Kilo-Org:devfrom
Olusammytee:fix/151-win32-flush-input-on-exit

Conversation

@Olusammytee
Copy link
Copy Markdown

Summary

  • flush Windows console input buffer when the Ctrl+C guard unhooks
  • ensure queued mouse events do not spill into the terminal after Kilo exits
  • preserve existing console mode restoration behavior

Fixes Kilo-Org/kilocode#6328

@github-actions
Copy link
Copy Markdown
Contributor

Hey! Your PR title fix(tui/win32): clear queued mouse input on Ctrl+C exit doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, kilo).

See CONTRIBUTING.md for details.

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented Feb 22, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • packages/opencode/src/cli/cmd/tui/win32.ts — Adds FlushConsoleInputBuffer call before restoring console mode in the unhook cleanup function. The FFI binding already exists (line 11), the handle is valid from the closure, and the flush-before-restore ordering is correct. Consistent with the existing win32FlushInputBuffer() export pattern.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a Windows-specific bug where mouse input events queued in the console buffer persist after the Kilo CLI exits with Ctrl+C, causing garbage text (e.g., [555;27;21M) to appear in the terminal when moving the mouse afterward. The fix adds a call to FlushConsoleInputBuffer in the unhook function to clear the input buffer before restoring the console mode.

Changes:

  • Adds FlushConsoleInputBuffer call to clear queued mouse/keyboard events before restoring normal console input mode on Windows

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@markijbema markijbema closed this Feb 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants