From: Christian Heller Date: Mon, 9 Jun 2025 13:38:58 +0000 (+0200) Subject: Minor constants renaming. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%22https:/validator.w3.org/foo.html?a=commitdiff_plain;h=978c8e1f01c1e270d4c03b25d6c505d18f6d6604;p=ircplom Minor constants renaming. --- diff --git a/ircplom.py b/ircplom.py index bd75336..a61a470 100755 --- a/ircplom.py +++ b/ircplom.py @@ -35,8 +35,8 @@ CMD_SHORTCUTS = { 'disconnect': 'window.disconnect', 'reconnect': 'window.reconnect' } -PREFIX_B64 = 'b64:' -OSC_52_PREFIX = ']52;c;' +B64_PREFIX = 'b64:' +OSC52_PREFIX = ']52;c;' IRCSPEC_LINE_SEPARATOR = b'\r\n' IRCSPEC_TAG_ESCAPES = ((r'\:', ';'), @@ -169,14 +169,14 @@ class Terminal: n_gotchs_unprocessed -= n_chs_blessed_key if unhandleds: fused = ''.join([chr(n) for n in unhandleds]) - if fused.startswith(OSC_52_PREFIX): - if not (encoded := fused[len(OSC_52_PREFIX):]): + if fused.startswith(OSC52_PREFIX): + if not (encoded := fused[len(OSC52_PREFIX):]): while True: gotch = self._blessed.getch() if ord(gotch) == 7: break encoded += gotch - yield f'{PREFIX_B64}{encoded}' + yield f'{B64_PREFIX}{encoded}' continue yield str(unhandleds) elif blessed_key.name: @@ -671,7 +671,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{OSC_52_PREFIX}?\007', self._y_status) + self._term.write(f'\033{OSC52_PREFIX}?\007', self._y_status) self.draw() @@ -858,8 +858,8 @@ class KeyboardLoop(Loop): 'Loop receiving and translating keyboard events towards main loop.' def process_bonus(self, yielded: str) -> None: - if yielded.startswith(PREFIX_B64): - encoded = yielded[len(PREFIX_B64):] + if yielded.startswith(B64_PREFIX): + encoded = yielded[len(B64_PREFIX):] to_paste = '' for i, c in enumerate(b64decode(encoded).decode('utf-8')): if i > 512: