Skip to content

Commit ffe6368

Browse files
k4cper-gclaude
andcommitted
Fix long text input dropping characters on Windows
_type() now tries ValuePattern.SetValue() before falling back to SendInput keyboard simulation. This bypasses the message queue entirely for elements that support it (e.g. Notepad). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 82a75aa commit ffe6368

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/actions/windows.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,13 @@ export class WindowsActionHandler implements ActionHandler {
584584
}
585585

586586
private async _type(hwnd: number, nodeIndex: number, text: string): Promise<ActionResult> {
587-
// Focus the element first
587+
// Fast path: try ValuePattern.SetValue (instant, lossless, no keyboard sim).
588+
const setResult = await this._uiaAction(hwnd, nodeIndex, "setvalue", { value: text });
589+
if (setResult.success) {
590+
return { success: true, message: `Typed: ${text}` };
591+
}
592+
593+
// Fallback: keyboard simulation via Unicode SendInput.
588594
const focusResult = await this._uiaAction(hwnd, nodeIndex, "focus", {});
589595
if (!focusResult.success) {
590596
return { success: false, message: "", error: `Failed to focus element for typing: ${focusResult.error}` };

0 commit comments

Comments
 (0)