Prefer xterm visible line for WebCRT command audit on Enter.

PTY stdout/stdin carry backspace and edit noise during typing; record only the final row the operator sees when pressing Enter.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-02 11:13:41 +08:00
parent 6ea14e6d5e
commit b35e56afb0
4 changed files with 42 additions and 18 deletions

View file

@ -778,7 +778,11 @@ export const WebTerminal = forwardRef<WebTerminalHandle, Props>(function WebTerm
e.preventDefault();
e.stopPropagation();
maybeFocus();
sendStdinImmediate(data);
if (e.key === "Enter") {
sendStdinWithAudit("\r", auditLineForEnter(term));
return;
}
sendStdinWithAudit(data);
};
window.addEventListener("keydown", onKeyDownCapture, true);