Taming Windows Terminal's win32-input-mode in Go ConPTY Applications
dev.to·18h·
Discuss: DEV
🔵Go
Preview
Report Post

When building agnt, a tool that gives AI coding agents browser superpowers, I hit a frustrating issue: my Ctrl+Y hotkey worked perfectly on macOS and Linux, but on Windows it produced garbage like [89;21;25;1;8;1_ instead of toggling my overlay menu.

This article documents the debugging journey and the solution - a Go 1.23+ iterator-based parser that correctly handles Windows Terminal’s win32-input-mode escape sequences.

The Problem

I was wrapping AI coding tools (Claude, Gemini, etc.) in a pseudo-terminal to inject an overlay UI. The overlay listens for Ctrl+Y (byte 0x19) to toggle a menu. Simple enough:

if b == 0x19 { // Ctrl+Y
overlay.Toggle()
}

On Unix, this worked immediately. On Windows with ConPTY, pressin…

Similar Posts

Loading similar posts...