fix(web): exact iOS caret, review fixes and round-eight items (#830)

Toolbar Enter spends one-shot Ctrl; Backspace finds the last grapheme with Segments.containing(); accessory Shift+Tab keeps the draft like a typed one.
Pass the captured session to Compose uploads, voice compose and held CJK drafts; clear Ctrl on deletion-only native edits; path picker clears predictions.
Clear xterm dead-key state on native commits; restore a borrowed clipboard field before classifying a key; overlay removeChar spans the pending/flushed boundary.
Place the trackpad caret from the overlay layout (getInputAnchor, committedText) or validated xterm cells, hiding when unproven; no end-minus-width arithmetic.
Grapheme-aware replay Backspace; docs, README rows, changeset and comment updates.
This commit is contained in:
Hadrien Kerlero committed 2026-11-21 21:16:13 +01:00
1 parent 414dd51eb2
commit cda5d96451
26 files changed
+1072 -170

No files matched your search

+37
View File
@@ -290,6 +290,7 @@ describe('dictation target', () => {
const textarea = { value: '', focus: vi.fn(), blur: vi.fn(), selectionStart: 0, selectionEnd: 0 };
doc.createElement = () => ({
className: '',
dataset: {},
innerHTML: '',
remove: vi.fn(),
addEventListener: vi.fn(),
@@ -314,6 +315,42 @@ describe('dictation target', () => {
expect(overlayClear).not.toHaveBeenCalled();
});
it('retargets an existing compose overlay for the next dictation', () => {
const { voice, sendInputAsync, doc } = load({ insertMode: 'compose' });
const handlers = new Map<string, () => void>();
const textarea = {
value: '',
focus: vi.fn(),
blur: vi.fn(),
selectionStart: 0,
selectionEnd: 0,
closest: (): { dataset: Record<string, string> } => overlay,
};
const overlay = {
dataset: {},
className: '',
innerHTML: '',
remove: vi.fn(),
addEventListener: vi.fn(),
querySelector: (sel: string) =>
sel === 'textarea'
? textarea
: {
addEventListener: (_type: string, handler: () => void) => handlers.set(sel, handler),
},
};
doc.createElement = () => overlay;
voice._targetSessionId = 'session-a';
voice._insertText('first dictation');
doc.querySelector = (sel: string) => (sel === '.voice-compose-overlay .paste-textarea' ? textarea : null);
voice._targetSessionId = 'session-b';
voice._insertText('second dictation');
handlers.get('.paste-send')!();
expect(sendInputAsync).toHaveBeenCalledExactlyOnceWith('session-b', 'second dictation\r', { useMux: true });
});
it('refuses to start with no session at all', () => {
const { voice, app, showToast } = load();
app.activeSessionId = null;