Skip to content

Comments

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

Open
Olusammytee wants to merge 1 commit intoKilo-Org:devfrom
Olusammytee:fix/151-win32-flush-input-on-exit
Open

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

Conversation

@Olusammytee
Copy link
Contributor

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 #151

Copilot AI review requested due to automatic review settings February 22, 2026 18:41
@github-actions
Copy link
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.

@kiloconnect
Copy link
Contributor

kiloconnect 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
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant