fix(desktop): prevent modifier key buffer resets, clipboard race on terminal accept, and redundant UIA settle snapshots
This commit is contained in:
parent
6d909dd0e5
commit
41901c1ec5
10 changed files with 198 additions and 23 deletions
|
|
@ -354,6 +354,42 @@ describe('terminal prompt extraction', () => {
|
|||
expect(tracker.hasObservedImeForHwnd(hwnd)).toBe(true)
|
||||
expect(tracker.currentPrefix()).toBe('ㅔㅊ ')
|
||||
})
|
||||
|
||||
it('Ctrl/Alt/Shift 단독 키 반복이나 Ctrl+Alt 제안 탐색 단축키는 터미널 버퍼를 초기화하지 않는다', () => {
|
||||
const tracker = new TerminalKeystrokeTracker()
|
||||
const hwnd = 9902
|
||||
for (const vk of [0x47, 0x49, 0x54, 0x20]) {
|
||||
tracker.onKeyDown({
|
||||
hwnd,
|
||||
windowTitle: 'Agent Switchboard',
|
||||
vk,
|
||||
shift: false,
|
||||
ctrl: false,
|
||||
alt: false,
|
||||
meta: false
|
||||
})
|
||||
}
|
||||
expect(tracker.currentPrefix()).toBe('git ')
|
||||
|
||||
// Ctrl 누름(uiohook 은 ctrl=true 로 전달) + Alt 누름(ctrl=true, alt=true) + Ctrl+Alt+Down/Enter
|
||||
for (const ev of [
|
||||
{ vk: 0xa2, ctrl: true, alt: false },
|
||||
{ vk: 0xa4, ctrl: true, alt: true },
|
||||
{ vk: 0x28, ctrl: true, alt: true },
|
||||
{ vk: 0x0d, ctrl: true, alt: true }
|
||||
]) {
|
||||
tracker.onKeyDown({
|
||||
hwnd,
|
||||
windowTitle: 'Agent Switchboard',
|
||||
vk: ev.vk,
|
||||
shift: false,
|
||||
ctrl: ev.ctrl,
|
||||
alt: ev.alt,
|
||||
meta: false
|
||||
})
|
||||
}
|
||||
expect(tracker.currentPrefix()).toBe('git ')
|
||||
})
|
||||
})
|
||||
|
||||
describe('a visible suggestion survives a typing pause', () => {
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue