/ Stateful normalizer for bytes written to a Windows pseudoconsole. / / ConPTY accepts UTF-8 input, but an Enter key is represented by a carriage / return on Windows. This converts line feeds and collapses existing CRLF / sequences, including when the two bytes arrive in separate
// Source: https://github.com/openinterpreter/openinterpreter | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
/// Stateful normalizer for bytes written to a Windows pseudoconsole.
///
/// ConPTY accepts UTF-8 input, but an Enter key is represented by a carriage
/// return on Windows. This converts line feeds and collapses existing CRLF
/// sequences, including when the two bytes arrive in separate writes, so each
/// requested newline submits exactly one line. Backspace is encoded as DEL,
/// which ConPTY translates to `VK_BACK`. All other bytes, including UTF-8 and
/// terminal control characters, pass through unchanged.
#[derive(Default)]
pub struct WindowsTtyInputNormalizer {
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key