fix(desktop): prevent modifier key buffer resets, clipboard race on terminal accept, and redundant UIA settle snapshots

This commit is contained in:
Yun Chan 2026-10-31 04:19:53 +09:00
parent 6d909dd0e5
commit 41901c1ec5
10 changed files with 198 additions and 23 deletions

View file

@ -119,6 +119,8 @@ export function classifyKeyStroke(
code: number,
modifiers: { ctrl: boolean; alt: boolean; meta: boolean }
): KeyStrokeClass {
if (code >= 0xa0 && code <= 0xa5) return 'modifier'
if (code === 0x5b || code === 0x5c || code === 0x10 || code === 0x11 || code === 0x12) return 'modifier'
if (modifiers.ctrl || modifiers.alt || modifiers.meta) return 'shortcut'
if (code >= 0x41 && code <= 0x5a) return 'letter'
if (code >= 0x30 && code <= 0x39) return 'digit'
@ -131,8 +133,6 @@ export function classifyKeyStroke(
if (code >= 0x25 && code <= 0x28) return 'arrow'
if (code >= 0x21 && code <= 0x24) return 'navigation'
if (code >= 0x70 && code <= 0x87) return 'function'
if (code >= 0xa0 && code <= 0xa5) return 'modifier'
if (code === 0x5b || code === 0x5c || code === 0x10 || code === 0x11 || code === 0x12) return 'modifier'
if (code === 0x1b) return 'navigation'
if (code >= 0xba && code <= 0xc0) return 'symbol'
if (code >= 0xdb && code <= 0xde) return 'symbol'

View file

@ -558,6 +558,29 @@ export class TerminalKeystrokeTracker {
const { vk, shift, ctrl, alt, meta } = input
// 순수 수정자 키(Shift/Ctrl/Alt/Win) 단독 눌림·키 반복은 버퍼나 조합 상태를 바꾸지 않는다.
if (
vk === 0x10 ||
vk === 0x11 ||
vk === 0x12 ||
vk === 0x5b ||
vk === 0x5c ||
(vk !== null && vk >= 0xa0 && vk <= 0xa5)
) {
return
}
// D3RO Voice 전역 제안/음성 단축키(Ctrl+Alt+방향키/Enter/Space/Backspace)는 OS globalShortcut 이 가로채므로
// 터미널 입력 줄 버퍼를 초기화하지 않는다.
if (
ctrl &&
alt &&
!meta &&
(vk === 0x0d || vk === 0x20 || vk === 0x08 || (vk !== null && vk >= 0x25 && vk <= 0x28))
) {
return
}
// Escape 또는 Ctrl+[ / Ctrl+C → 현재 줄 초기화 (실제 Esc/Ctrl+[ 만 _afterEscape 설정)
const isRealEscape = vk === 0x1b || (ctrl && !alt && !meta && vk === 0xdb)
const isCtrlC = ctrl && !alt && !meta && vk === 0x43