diff --git a/packages/tui/CHANGELOG.md b/packages/tui/CHANGELOG.md index 269e4b93..da366a9b 100644 --- a/packages/tui/CHANGELOG.md +++ b/packages/tui/CHANGELOG.md @@ -7,6 +7,7 @@ - Reduced flicker by only re-rendering changed lines ([#617](https://github.com/badlogic/pi-mono/pull/617) by [@ogulcancelik](https://github.com/ogulcancelik)) - Cursor position tracking when content shrinks with unchanged remaining lines - TUI renders with wrong dimensions after suspend/resume if terminal was resized while suspended ([#599](https://github.com/badlogic/pi-mono/issues/599)) +- Pasted content containing Kitty key release patterns (e.g., `:3F` in MAC addresses) was incorrectly filtered out ([#623](https://github.com/badlogic/pi-mono/pull/623) by [@ogulcancelik](https://github.com/ogulcancelik)) ## [0.42.4] - 2026-01-10 diff --git a/packages/tui/src/keys.ts b/packages/tui/src/keys.ts index b013da36..21c96508 100644 --- a/packages/tui/src/keys.ts +++ b/packages/tui/src/keys.ts @@ -314,6 +314,14 @@ let _lastEventType: KeyEventType = "press"; * Only meaningful when Kitty keyboard protocol with flag 2 is active. */ export function isKeyRelease(data: string): boolean { + // Don't treat bracketed paste content as key release, even if it contains + // patterns like ":3F" (e.g., bluetooth MAC addresses like "90:62:3F:A5"). + // Terminal.ts re-wraps paste content with bracketed paste markers before + // passing to TUI, so pasted data will always contain \x1b[200~. + if (data.includes("\x1b[200~")) { + return false; + } + // Quick check: release events with flag 2 contain ":3" // Format: \x1b[;:3u if ( @@ -336,6 +344,12 @@ export function isKeyRelease(data: string): boolean { * Only meaningful when Kitty keyboard protocol with flag 2 is active. */ export function isKeyRepeat(data: string): boolean { + // Don't treat bracketed paste content as key repeat, even if it contains + // patterns like ":2F". See isKeyRelease() for details. + if (data.includes("\x1b[200~")) { + return false; + } + if ( data.includes(":2u") || data.includes(":2~") ||