From 7f2d9522d7ef8d6fb49dbdac853e642dc698e8eb Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Mon, 9 Jun 2025 16:02:19 +0200 Subject: [PATCH] Minor OSC52 / clipboard paste refactoring. --- ircplom.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ircplom.py b/ircplom.py index 5472072..67d8ae2 100755 --- a/ircplom.py +++ b/ircplom.py @@ -38,6 +38,7 @@ CMD_SHORTCUTS = { } B64_PREFIX = 'b64:' OSC52_PREFIX = ']52;c;' +PASTE_DELIMITER = '\007' IRCSPEC_LINE_SEPARATOR = b'\r\n' IRCSPEC_TAG_ESCAPES = ((r'\:', ';'), @@ -192,7 +193,7 @@ class Terminal: if not (encoded := fused[len(OSC52_PREFIX):]): while True: gotch = self._blessed.getch() - if ord(gotch) == 7: + if gotch == PASTE_DELIMITER: break encoded += gotch yield f'{B64_PREFIX}{encoded}' @@ -693,7 +694,7 @@ class Window(Widget): def cmd__paste(self) -> None: 'Write OSC 52 ? sequence to get encoded clipboard paste into stdin.' - self._term.write(f'\033{OSC52_PREFIX}?\007', + self._term.write(f'\033{OSC52_PREFIX}?{PASTE_DELIMITER}', self._y_status) self.draw() -- 2.30.2