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

fix: guard mouse capture bytes assertion for Windows#38

Closed
noahgift wants to merge 1 commit intomainfrom
fix/windows-mouse-capture-test
Closed

fix: guard mouse capture bytes assertion for Windows#38
noahgift wants to merge 1 commit intomainfrom
fix/windows-mouse-capture-test

Conversation

@noahgift
Copy link
Copy Markdown
Contributor

@noahgift noahgift commented Apr 5, 2026

Summary

  • Guards the bytes-written assertion in test_testable_backend_enable_mouse_capture with #[cfg(not(target_os = "windows"))]
  • crossterm uses Win32 Console API on Windows instead of ANSI escapes, so no bytes are written to the Vec<u8> writer
  • The is_mouse_captured() assertion already verifies correctness on all platforms
  • Also applies cargo fmt to pre-existing formatting issues in build.rs and contract_traits.rs

Closes #37

Five-Whys

  1. output Vec is empty after enable_mouse_capture() on Windows
  2. crossterm uses Windows Console API, not ANSI escape sequences
  3. EnableMouseCapture dispatches to SetConsoleMode on Windows
  4. Test assumes ANSI output (Unix behavior)
  5. Main CI runs on Linux; cross-platform added later

Test plan

  • Cross-platform CI passes on Windows
  • Main CI still passes on Linux

🤖 Generated with Claude Code

crossterm's EnableMouseCapture uses Windows Console API (SetConsoleMode)
instead of writing ANSI escape sequences on Windows. The bytes-written
assertion is only valid on Unix targets.

Also applies cargo fmt to pre-existing formatting issues in build.rs
and contract_traits.rs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

Thank you for your interest in this project, @noahgift.

This repository only accepts pull requests from organization members and authorized contributors. Your PR has been closed automatically.

If you believe you should have access, please open an issue to discuss your contribution first.

@github-actions github-actions bot closed this Apr 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cross-platform: enable_mouse_capture test fails on Windows (crossterm Win32 API)

1 participant