Improve WebCRT connect UX and terminal input handling.

Open shells asynchronously with clearer prompt settling, fix Telnet CRLF expansion, and add right-click paste with safer focus behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-10-11 22:55:31 +08:00
parent 1463652dbb
commit 3b45d6abe3
8 changed files with 108 additions and 71 deletions

View file

@ -89,10 +89,8 @@ def map_network_cli_enter(data: str, conn: ConnectHandler | None) -> str:
if not text:
return text
ret = channel_return(conn)
if ret == "\r":
return text
# Prefer replacing CRLF first so Telnet RETURN \\r\\n does not double-expand.
return text.replace("\r\n", ret).replace("\r", ret)
# Replace once: chained replacements expand the CR in Telnet CRLF again.
return re.sub(r"\r\n|\r|\n", lambda _match: ret, text)
def _drain_channel(conn: ConnectHandler, *, rounds: int = 6, wait: float = 0.06) -> str: