crossterm-rs/crossterm
76.8
Strong · 14 November 2026
11.4k
lines of production code
Rust
primary language
5
measurements over time
What this system is
Features
Initial release of the crossterm terminal manipulation library
This change introduces the initial version of the crossterm crate, providing a cross-platform API for terminal manipulation. It includes modules for cursor movement and styling, terminal resizing and raw mode control, and an event system for reading keyboard, mouse, and resize inputs. The library implements a Command API that allows users to queue or directly execute actions like printing styled text, moving the cursor, and managing screen buffers, with platform-specific fallbacks to WinAPI on older Windows versions and ANSI escape codes on modern systems and Unix.
src · high confidence
New and updated terminal examples
The examples directory has been reorganized and expanded with new demonstrations for key features. A new README documents the structure and provides run instructions. New examples include \copy-to-clipboard\ for OSC52 clipboard integration, \event-match-modifiers\ for handling keyboard modifiers, \event-poll-read\ for blocking event polling, \event-read-char-line\ for character and line input, \event-read\ for comprehensive event handling with keyboard enhancement flags, \event-stream-smol\ and \event-stream-tokio\ for asynchronous event streams, \key-display\ for key event formatting, \link\ for OSC 8 hyperlinks, and \stderr\ for writing to standard error. Existing examples have been updated to reflect current APIs.
examples · high confidence
New interactive demo application for testing crossterm features
The interactive demo has been restructured into a new standalone application located in \examples/interactive-demo/src\. This change introduces a menu-driven interface that allows users to individually test core crossterm capabilities, including cursor movement, color attributes, input events, and synchronized output. The implementation consolidates the test logic into modular components (\cursor\, \color\, \attribute\, \event\, \synchronized\_output\) and utilizes a custom macro for streamlined test execution and navigation.
examples/interactive-demo/src · high confidence
Platform-specific event system implementation for Windows
The event system now includes a dedicated Windows implementation in \src/event/sys/windows.rs\, providing platform-specific input handling, mouse capture enable/disable logic, and console mode management. This file exposes internal modules for parsing, polling, and waker functionality (conditional on the \event-stream\ feature), establishing the Windows backend for the events module.
src/event/sys · high confidence
Behavioural changes
Add focus event support and refine Windows event source implementation
The Windows event source now emits FocusGained and FocusLost events when the terminal window gains or loses focus, allowing applications to react to visibility changes. Additionally, the implementation ensures that Windows resize events match the terminal size reported by the standard size function by adjusting the coordinate offset (adding one to replicate Unix behavior starting at 1 instead of 0). The code also handles mouse button state tracking for left, right, and middle buttons more explicitly and conditionally initializes the poller based on the event-stream feature.
src/event/source · high confidence
Cursor position and movement now use platform-specific system implementations
The cursor module now delegates to dedicated platform-specific implementations for Unix and Windows. On Unix, cursor position is retrieved by sending an escape sequence and filtering for the response, ensuring accurate reporting even when other events are pending. On Windows, cursor positioning and movement are handled via WinAPI calls, with relative Y-coordinates calculated based on the terminal window's position in the screen buffer. This change introduces a new internal structure for managing cursor state and visibility on Windows, replacing previous generic logic with OS-native behavior.
src/cursor/sys · high confidence
Improved Windows event parsing and optional event-stream waker support
The Windows event subsystem now features a dedicated \parse.rs\ module that improves keyboard input handling by correctly managing Unicode surrogate pairs for characters outside the Basic Multilingual Plane and respecting the active keyboard layout for character case. Mouse event handling has been enhanced to support left, right, and middle button states, including release events. Additionally, when the \event-stream\ feature is enabled, the polling mechanism (\poll.rs\) integrates a \Waker\ (implemented in \waker.rs\) using a Windows semaphore, allowing asynchronous wake-ups of the poll loop.
src/event/sys/windows · high confidence
Platform-specific terminal implementation module introduced
A new \src/terminal/sys.rs\ module has been added to centralize platform-specific terminal operations. This module exposes functions for managing raw mode (enabling, disabling, and checking status), retrieving terminal size and window size, and handling scrolling on Windows, while also providing keyboard enhancement support checks on Unix and Windows. It acts as the concrete system-level interface for terminal control, delegating to platform-specific sub-modules.
src/terminal · high confidence
Raise MSRV to Rust 1.85 and migrate to Rust 2024 edition
The minimum supported Rust version (MSRV) has been raised from 1.63 to 1.85, and the crate has been migrated to the Rust 2024 edition. As part of this update, the custom \IsTty\ trait has been removed in favor of the standard library's \std::io::IsTerminal\ trait. Additionally, color commands (such as \SetForegroundColor\ and \SetBackgroundColor\) no longer emit a bare \CSI m\ escape sequence when colors are disabled via \NO\COLOR\, preventing unintended attribute resets. Several parser bugs have also been fixed, including an integer underflow in mouse/cursor-position parsers and a logic error where \Colors::from(Colored::UnderlineColor(\))\ incorrectly set the background color.
(repo-wide) · high confidence
Refactored event module with internal filtering and optional async stream
The event handling logic has been restructured to improve modularity and performance. Internal event processing is now encapsulated in a dedicated \internal\ module, and a new \Filter\ trait allows specific event types (such as cursor position or keyboard enhancement flags) to be filtered out before they reach the public API, reducing unnecessary processing. Additionally, the asynchronous event stream capability is now an optional feature (\event-stream\), requiring explicit opt-in to use the \EventStream\ type for integration with async runtimes like \smol\ or \tokio\.
src/event · high confidence
Refactored style module with new Attributes bitset and OSC 8 hyperlink support
The style module has been restructured to improve performance and add new capabilities. The \Attributes\ type is now backed by a \u32\ bitset, enabling const-context construction and efficient bitwise operations for managing text attributes. A new \ContentStyle\ struct centralizes foreground, background, and underline colors alongside attributes, exposed via the unified \Stylize\ trait which provides fluent methods for styling text. Additionally, the library now supports OSC 8 hyperlinks through \StartHyperlink\ and \EndHyperlink\ commands, allowing users to create clickable links in supported terminals.
src/style · high confidence
Support for colored underlines and NO\_COLOR environment variable
The style types now support setting an underline color via the new \Colored::UnderlineColor\ variant, allowing terminals that support SGR 58 to render underlines in specific colors. Additionally, the library now respects the \NO\_COLOR\ environment variable; when set, ANSI color sequences are disabled, and the output remains plain text. This behavior can be overridden programmatically using the new \Colored::set\_ansi\_color\_disabled\ API.
src/style/types · high confidence
Unified file descriptor handling with optional libc/rustix backend
The terminal system layer now uses a new \FileDesc\ wrapper in \src/terminal/sys/file\_descriptor.rs\ to manage raw file descriptors, automatically closing them on drop when opened. This abstraction supports two backends: the traditional \libc\ crate (when the \libc\ feature is enabled) and \rustix\ (the default), allowing the library to reduce unsafe code and dependency surface. This change affects how terminal attributes, window sizes, and keyboard enhancement flags are queried and set on both Unix and Windows, ensuring consistent resource management across platforms.
src/terminal/sys · high confidence
Unix event parsing and waker implementation
The Unix subsystem now includes a new event parser (src/event/sys/unix/parse.rs) that handles key events, mouse events, and focus changes, along with a conditional waker module (src/event/sys/unix/waker.rs) that switches between a TTY-based and mio-based implementation depending on the 'use-dev-tty' feature flag.
src/event/sys/unix · high confidence
Unix event source now supports pluggable polling backends (mio or filedescriptor)
The Unix event source implementation has been refactored to support two distinct polling backends: the existing \mio\-based implementation and a new \filedescriptor\-based implementation. This change allows the library to switch between different low-level polling mechanisms, potentially improving compatibility or performance depending on the selected feature. The new \filedescriptor\ backend uses \rustix\ for file descriptor handling and \signal-hook\ for signal management, replacing the previous \libc\-based approach in that specific backend. Both backends provide the same \EventSource\ interface, ensuring that higher-level code remains unchanged regardless of the underlying polling mechanism.
src/event/source/unix · high confidence
Unix waker implementation switched from mio to UnixStream
The Unix waker mechanism has been replaced to no longer depend on the mio library for waking up the event loop. Instead, the implementation now uses a UnixStream to send a single byte, providing a direct pipe-based wake-up signal. This change removes the mio dependency from this specific component, simplifying the internal event signaling path.
src/event/sys/unix/waker · high confidence
Windows console styling now uses crossterm-winapi for color handling
The Windows-specific styling implementation in \src/style/sys/windows.rs\ has been rewritten to use the \crossterm-winapi\ crate instead of direct WinAPI calls. This change updates how foreground and background colors are applied to the console, ensuring compatibility with the broader crossterm ecosystem while maintaining support for legacy Windows versions that do not support ANSI escape codes. The new implementation correctly handles color attributes, intensity flags, and resets by interacting with the current screen buffer via crossterm's abstractions.
src/style/sys · high confidence
Test coverage
Added interactive demo tests for style, color, cursor, events, and synchronized output; Added tests for styled content formatting preservation.
Dependencies
Crossterm 0.29.0 release with Rust 2024 edition and MSRV 1.85
The crossterm library has been updated to version 0.29.0, migrating the crate to the Rust 2024 edition and raising the Minimum Supported Rust Version (MSRV) to 1.85.0. This release includes dependency updates such as base64 to 0.23 and bitflags to 2.9, and introduces new feature flags including \osc52\ for host clipboard interaction and \use-dev-tty\ for raw file descriptor polling. The interactive demo example has also been updated to align with the new edition and MSRV requirements.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 75 → 77 (+1.8)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 95 → 93 (-2.1)
- Architecture 88 → 100 (+12.2)
- Maturity 65 → 66 (+1.5)
- Readiness 78 → 85 (+7.0)
- Security 88 → 81 (-6.3)
- Event Sourcing 100 → 100 (+0.0)
Resolved (7)
- Duplicated block (23 lines × 2) (src/event/source/unix/mio.rs)
- Duplicated block (3–5 lines × 5) (src/event/sys/unix/parse.rs)
- Hotspot: src/event/source/unix/tty.rs (src/event/source/unix/tty.rs)
- Off-boarding risk: anonymized user #1
- Orphaned file (src/style/types/attribute.rs)
- Outdated: rustix
- Projects may be oversized for their cohesion
New (17)
- Duplicated block (23 lines × 2) (src/event/source/unix/mio.rs)
- Duplicated block (3–5 lines × 5) (src/event/sys/unix/parse.rs)
- Edited copy of a member (14 corresponding lines) (src/terminal/sys/windows.rs)
- Edited copy of a member (24 corresponding lines) (src/style/sys/windows.rs)
- Edited copy of a member (26 corresponding lines) (src/event/sys/unix/parse.rs)
- Further sole-owners (lower concentration)
- Low coverage: src/cursor.rs (src/cursor.rs)
- Low coverage: src/cursor/sys/unix.rs (src/cursor/sys/unix.rs)
- Low coverage: src/event/commands.rs (src/event/commands.rs)
- Low coverage: src/event/internal.rs (src/event/internal.rs)
- Low coverage: src/event/source/unix/mio.rs (src/event/source/unix/mio.rs)
- Low coverage: src/macros.rs (src/macros.rs)
- Low coverage: src/style/attributes.rs (src/style/attributes.rs)
- Low coverage: src/terminal.rs (src/terminal.rs)
- Low coverage: src/terminal/sys/file_descriptor.rs (src/terminal/sys/file_descriptor.rs)
- Low coverage: src/terminal/sys/unix.rs (src/terminal/sys/unix.rs)
- Off-boarding risk: anonymized user #1
Changes since last survey
- 7 commits — 4 feature/other, 3 fixes
By area
- (root) — 3 commits
- .github/workflows — 1 commit
- src/event — 1 commit
- src/style — 1 commit
- src/terminal.rs — 1 commit
Notable commits
- fix: fix(cursor): clamp Windows legacy-console cursor moves at the edge (#1112)
- fix: fix(deps): bump rustix and async-executor to clear cargo deny (#1171)
- fix: fix(windows): size the UTF-16 key translation buffer correctly (#1103)
- change: build(deps): bump the github-actions group with 3 updates (#1164)
- change: docs(style): clarify that Reset and ResetColor clear all styling (#1163)
- change: docs(terminal): fix raw mode function links (#1170)
- change: docs: drop redundant explicit rustdoc link targets (#1172)
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
crossterm-rs/crossterm was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 14 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit de206a81d68662c2c77db27b39235a21a453c324 — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-3c33c1882dc1.