mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 03:10:46 +08:00
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:
parent
6ea14e6d5e
commit
b35e56afb0
4 changed files with 42 additions and 18 deletions
|
|
@ -372,13 +372,14 @@ class WebcrtSession:
|
|||
if "\r" in text or "\n" in text:
|
||||
from .webcrt_channel import extract_last_prompt_command, normalize_audit_line
|
||||
|
||||
cmd = extract_last_prompt_command(self._stdout_tail) or self._last_prompt_line
|
||||
if not cmd and audit_line:
|
||||
# Ground truth: xterm visible row at Enter (frontend). PTY stdout/stdin
|
||||
# still carry intermediate backspaces / tab redraws — do not prefer those.
|
||||
if audit_line and str(audit_line).strip():
|
||||
cmd = normalize_audit_line(audit_line)
|
||||
if cmd and str(cmd).strip():
|
||||
lines = [cmd]
|
||||
else:
|
||||
lines = buf_lines
|
||||
raw = extract_last_prompt_command(self._stdout_tail) or self._last_prompt_line
|
||||
cmd = raw if raw else (buf_lines[-1] if buf_lines else None)
|
||||
lines = [cmd] if cmd and str(cmd).strip() else []
|
||||
self._last_prompt_line = ""
|
||||
else:
|
||||
lines = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue