MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / isKeyRelease

Function isKeyRelease

packages/pi-tui/src/keys.ts:527–551  ·  view source on GitHub ↗
(data: string)

Source from the content-addressed store, hash-verified

525 * Only meaningful when Kitty keyboard protocol with flag 2 is active.
526 */
527export function isKeyRelease(data: string): boolean {
528 // Don't treat bracketed paste content as key release, even if it contains
529 // patterns like ":3F" (e.g., bluetooth MAC addresses like "90:62:3F:A5").
530 // Terminal.ts re-wraps paste content with bracketed paste markers before
531 // passing to TUI, so pasted data will always contain \x1b[200~.
532 if (data.includes("\x1b[200~")) {
533 return false;
534 }
535
536 // Quick check: release events with flag 2 contain ":3"
537 // Format: \x1b[<codepoint>;<modifier>:3u
538 if (
539 data.includes(":3u") ||
540 data.includes(":3~") ||
541 data.includes(":3A") ||
542 data.includes(":3B") ||
543 data.includes(":3C") ||
544 data.includes(":3D") ||
545 data.includes(":3H") ||
546 data.includes(":3F")
547 ) {
548 return true;
549 }
550 return false;
551}
552
553/**
554 * Check if the last parsed key event was a key repeat.

Callers 2

handleInputMethod · 0.90
handleInputMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected