mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 23:01:56 +00:00
fix(tui): skip key release/repeat check for bracketed paste content
Pasted content containing Kitty key release patterns (e.g., :3F in bluetooth MAC addresses) was incorrectly detected as a key release event and dropped. The fix checks for bracketed paste markers before running pattern checks. Also applied to isKeyRepeat() for consistency. Closes #623
This commit is contained in:
parent
df3a220d6b
commit
eb15f326c1
2 changed files with 15 additions and 0 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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[<codepoint>;<modifier>: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~") ||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue