home · contact · privacy
In curses client, add ability to enter certain wide chars.
authorChristian Heller <c.heller@plomlompom.de>
Fri, 18 Dec 2020 20:27:49 +0000 (21:27 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 18 Dec 2020 20:27:49 +0000 (21:27 +0100)
rogue_chat_curses.py

index caf688a76724ee7c081771be4cb6b8e601613202..57c3750892c9049081ba255b8e77f42b5d46f4e6 100755 (executable)
@@ -1170,6 +1170,7 @@ class TUI:
         reset_screen_size()
         self.explorer = YX(0, 0)
         self.input_ = ''
+        store_widechar = False
         input_prompt = '> '
         interval = datetime.timedelta(seconds=5)
         last_ping = datetime.datetime.now() - interval
@@ -1204,6 +1205,13 @@ class TUI:
             keycode = None
             if len(key) == 1:
                 keycode = ord(key)
+                # workaround for <https://stackoverflow.com/a/56390915>
+                if store_widechar:
+                    store_widechar = False
+                    key = bytes([195, keycode]).decode()
+                if keycode == 195:
+                    store_widechar = True
+                    continue
             self.show_help = False
             self.draw_face = False
             if key == 'KEY_RESIZE':