fix(desktop): resolve Ctrl+Alt+Enter accept drops and duplicate typo LLM checks

This commit is contained in:
Yun Chan 2026-10-31 04:43:50 +09:00
parent 2a62f2496a
commit 02d0d0c6c1
15 changed files with 238 additions and 19 deletions

View file

@ -507,5 +507,35 @@ describe('KeyBindingService', () => {
expect.any(Function),
)
})
it('triggers suggestion-accept for NumpadEnter and via OS capture fallback when uiohook misses the key', () => {
vi.useFakeTimers()
try {
const service = getKeyBindingService()
const triggered: KeyBindingTriggerPayload[] = []
service.on('triggered', (payload) => triggered.push(payload))
service.loadFromConfig()
service.start()
service.setSuggestionCaptureActive(true)
// 1) NumpadEnter via uiohook
hook.keydown({ keycode: UiohookKey.NumpadEnter, ctrlKey: true, altKey: true })
hook.keyup({ keycode: UiohookKey.NumpadEnter, ctrlKey: true, altKey: true })
expect(triggered.filter((t) => t.actionId === 'suggestion-accept' && t.type === 'pressed')).toHaveLength(1)
// 2) OS globalShortcut callback fires without a recent uiohook press (e.g. elevated window / UIPI)
vi.advanceTimersByTime(300)
const returnCall = vi
.mocked(globalShortcut.register)
.mock.calls.find(([accelerator]) => accelerator === 'Control+Alt+Return')
const callback = returnCall?.[1] as (() => void) | undefined
expect(callback).toBeDefined()
callback?.()
vi.advanceTimersByTime(30)
expect(triggered.filter((t) => t.actionId === 'suggestion-accept' && t.type === 'pressed')).toHaveLength(2)
} finally {
vi.useRealTimers()
}
})
})
})