v1.8.98: fix ghost "eue" text in terminal — strip DCS/APC/PM/SOS sequences
pyte 0.8.2 doesn't handle DCS string sequences (ESC P ... ST). When nano/ncurses sends DECRQSS queries, pyte consumed the introducer but rendered the payload as visible text. Added regex pre-filter to strip DCS/APC/PM/SOS sequences before feeding data to pyte. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ DECCKM, bracketed paste, mouse tracking, and professional copy/paste UX.
|
||||
|
||||
import codecs
|
||||
import copy
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
import tkinter as tk
|
||||
@@ -44,6 +45,16 @@ _CURSOR_BG = "#d3d7cf"
|
||||
_DECCKM = 1 << 5 # Application cursor keys
|
||||
_BRACKETED_PASTE = 2004 << 5 # Bracketed paste mode
|
||||
_MOUSE_BASIC = 1000 << 5 # Basic mouse tracking
|
||||
|
||||
# ── Strip DCS/APC/PM/SOS string sequences that pyte doesn't handle ────────
|
||||
# These would otherwise leak payload bytes as visible text on screen.
|
||||
# Matches: ESC P ... ST | ESC _ ... ST | ESC ^ ... ST | ESC X ... ST
|
||||
# Also matches C1 variants (0x90, 0x9f, 0x9e, 0x98) and BEL as terminator.
|
||||
_DCS_STRING_RE = re.compile(
|
||||
r"(?:\x1b[P_^X]|\x90|\x9f|\x9e|\x98)" # string introducer
|
||||
r"[^\x1b\x07]*" # payload (anything except ESC/BEL)
|
||||
r"(?:\x1b\\|\x07|\x9c)?" # string terminator (ST/BEL) or end of data
|
||||
)
|
||||
_MOUSE_BTN_TRACK = 1002 << 5 # Button-event mouse tracking
|
||||
_MOUSE_ANY = 1003 << 5 # Any-event mouse tracking
|
||||
_MOUSE_SGR = 1006 << 5 # SGR extended mouse encoding
|
||||
@@ -343,6 +354,11 @@ class TerminalWidget(tk.Frame):
|
||||
def feed(self, data: bytes):
|
||||
"""Feed raw bytes from SSH into pyte, schedule debounced render."""
|
||||
text = self._utf8_decoder.decode(data)
|
||||
if not text:
|
||||
return
|
||||
# Strip DCS/APC/PM/SOS sequences that pyte can't parse
|
||||
# (their payload leaks as visible text otherwise)
|
||||
text = _DCS_STRING_RE.sub("", text)
|
||||
if not text:
|
||||
return
|
||||
self._stream.feed(text)
|
||||
|
||||
BIN
releases/ServerManager-v1.8.98-win-x64.exe
Normal file
BIN
releases/ServerManager-v1.8.98-win-x64.exe
Normal file
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
"""Version info for ServerManager."""
|
||||
|
||||
__version__ = "1.8.97"
|
||||
__version__ = "1.8.98"
|
||||
__app_name__ = "ServerManager"
|
||||
__author__ = "aibot777"
|
||||
__description__ = "Desktop GUI for managing remote servers"
|
||||
|
||||
Reference in New Issue
Block a user