mirror of
https://github.com/stablyai/orca.git
synced 2026-10-28 08:02:54 +00:00
fix(ime): carry the composition markers through the last two rebuilt inputs
Two more places rebuilt a keybinding input field-by-field and dropped the
markers the matcher refuses on.
`matchesRecentTabSwitcherChord` is the harder one: its callers pass the raw
event, so a call-site sweep reads clean, but the helper normalizes Shift away
by hand-building a literal one level down. Ctrl+Tab therefore still resolved
mid-composition.
The two `before-input-event` handlers omitted `isComposing` when feeding the
double-tap detector. `Electron.Input` does carry it — a completed gesture
dispatches `{ doubleTapModifier }` with no key or modifier flags, so once one
is armed the matcher has nothing left to refuse on.
Also covers the floating terminal panel, whose product fix already landed but
whose suite passed unchanged when both ownership decisions were mutated away.
Every guard here is mutation-checked: disabling one fails exactly the tests
that name it, and no others.
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -1315,6 +1315,41 @@ describe('createMainWindow', () => {
|
||||
const togglePreventDefault = triggerDoubleTapShift()
|
||||
expect(togglePreventDefault).toHaveBeenCalledTimes(1)
|
||||
expect(webContents.send).toHaveBeenCalledWith('ui:dictationKeyDown')
|
||||
|
||||
// `Electron.Input` carries `isComposing`. A completed gesture dispatches
|
||||
// `{ doubleTapModifier }` with no key or modifier flags, so the shortcut matcher has nothing
|
||||
// left to refuse on — the ownership check has to happen before the detector sees the press.
|
||||
const modifierInput = {
|
||||
code: 'ShiftLeft',
|
||||
key: 'Shift',
|
||||
shift: true,
|
||||
meta: false,
|
||||
control: false,
|
||||
alt: false
|
||||
}
|
||||
for (const markedIndex of [1, 0]) {
|
||||
webContents.send.mockClear()
|
||||
const steps = [
|
||||
{ ...modifierInput, type: 'keyUp' },
|
||||
{ ...modifierInput, type: 'keyDown' }
|
||||
]
|
||||
windowHandlers['before-input-event'](
|
||||
{ preventDefault: vi.fn() } as never,
|
||||
{ ...modifierInput, type: 'keyDown' } as never
|
||||
)
|
||||
for (const [index, step] of steps.entries()) {
|
||||
windowHandlers['before-input-event'](
|
||||
{ preventDefault: vi.fn() } as never,
|
||||
(index === markedIndex ? { ...step, isComposing: true } : step) as never
|
||||
)
|
||||
}
|
||||
expect(webContents.send).not.toHaveBeenCalledWith('ui:dictationKeyDown')
|
||||
// Clear the trailing armed state so the next case starts from idle.
|
||||
windowHandlers['before-input-event'](
|
||||
{ preventDefault: vi.fn() } as never,
|
||||
{ code: 'KeyA', key: 'a', type: 'keyDown' } as never
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
it('forwards ctrl/cmd+j to the worktree palette toggle event', () => {
|
||||
|
||||
Reference in New Issue
Block a user