From ad1164c29d5deb3f9cecb3aee3798c0e08b5f0f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=91=D0=BE=D0=B1?= =?UTF-8?q?=D1=8B=D1=80=D0=B5=D0=B2?= Date: Thu, 21 May 2026 00:13:24 +0300 Subject: [PATCH] fix: Windows Ctrl+V paste + filter control char blocks Co-Authored-By: Claude Opus 4.6 --- ssh_manager.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ssh_manager.py b/ssh_manager.py index 4e7b27b..489944b 100644 --- a/ssh_manager.py +++ b/ssh_manager.py @@ -761,10 +761,14 @@ class TerminalWidget(tk.Frame): self.text.bind("", lambda e: self._send("\x04")) self.text.bind("", lambda e: self._send("\x0c")) self.text.bind("", lambda e: self._send("\x1a")) - # macOS: Command+V paste into terminal, Command+C copy selection + # Paste/Copy in terminal: send clipboard to SSH / copy selection if sys.platform == "darwin": self.text.bind("", self._term_paste) self.text.bind("", self._term_copy) + else: + # Windows/Linux: Ctrl+V paste, Ctrl+Shift+C copy + self.text.bind("", self._term_paste) + self.text.bind("", self._term_copy) self.text.tag_configure("error", foreground="#f38ba8") self.text.tag_configure("info", foreground="#89b4fa") @@ -805,6 +809,11 @@ class TerminalWidget(tk.Frame): break text = data.decode("utf-8", errors="replace") clean = strip_ansi(text) + # Remove control chars except \n \t \x08 \x7f (handled by _write) + clean = "".join( + ch for ch in clean + if ch in "\n\t\x08\x7f" or ord(ch) >= 32 + ) self._write(clean) except socket.timeout: continue