~callum/barszcz

03517085bc7765c5b92e91b77ab0fd3b0248583b — Callum Brown 2 years ago 24d2168
Fix Enter and Escape shortcut keys

Need to check for them before unctrl
1 files changed, 7 insertions(+), 5 deletions(-)

M beetsplug/barszcz.py
M beetsplug/barszcz.py => beetsplug/barszcz.py +7 -5
@@ 509,16 509,18 @@ class Barszcz:

        while self.running:
            key = stdscr.getkey()
            try:
                key = curses.ascii.unctrl(key)
            except TypeError:
                # Ctrl+[non-alpha] can cause error in curses. E.g. Ctrl+6.
                pass
            # Convert miscellaneous keypresses to string codes
            if key == "\n":
                key = "KEY_ENTER"
            elif len(key) == 1 and ord(key) == 27:
                key = "KEY_ESCAPE"
            else:
                try:
                    key = curses.ascii.unctrl(key)
                    pass
                except TypeError:
                    # Ctrl+[non-alpha] can cause error in curses. E.g. Ctrl+6.
                    pass

            if key == ":":
                input_win.clear()