fix(mobile): stop accessory repeats after IME send failure

This commit is contained in:
Brennan Benson
2026-08-27 15:32:38 -07:00
parent 7a805da421
commit e5f5cd825d
2 changed files with 18 additions and 3 deletions
@@ -165,6 +165,20 @@ describe('terminal live accessory input commit hook', () => {
expect(result).toEqual({ kind: 'handled' })
})
it('Given held text with a failed control send When committed Then reports the accessory input as suppressed', async () => {
const harness = createAccessoryInputCommitHarness({
heldText: '한',
pendingHandle: 'terminal-a',
sendResult: false
})
const result = await harness.commit({ bytes: '\x1b' })
expect(harness.flushPendingLiveInputText).toHaveBeenCalledWith('terminal-a')
expect(harness.sent).toEqual(['\x1b'])
expect(result).toEqual({ kind: 'suppress-raw' })
})
it('Given raw accessory bytes with no held text When committed Then allows the raw send without flushing', async () => {
// Given
const harness = createAccessoryInputCommitHarness({ pendingHandle: null })
@@ -84,12 +84,13 @@ export function useTerminalLiveAccessoryInputCommit({
applyLiveInputMirror(activeHandle, editedText)
return { kind: 'handled' }
}
case 'commit-held-then-send':
await sendTerminalLiveControlAfterPendingFlush(
case 'commit-held-then-send': {
const sent = await sendTerminalLiveControlAfterPendingFlush(
() => flushPendingLiveInputText(activeHandle),
() => sendLiveTerminalInputRef.current(activeHandle, decision.bytes)
)
return { kind: 'handled' }
return sent ? { kind: 'handled' } : { kind: 'suppress-raw' }
}
default:
decision satisfies never
return { kind: 'handled' }