# HG changeset patch # User Sietse Brouwer # Date 1590757919 -7200 # Fri May 29 15:11:59 2020 +0200 # Node ID ec7aaf4537f5b628e22798caa96d77fcdb6f0d75 # Parent ad995b7166e82f6ff907009579502e2b0e160a96 Handle 'no input' errors on t.getkey() diff --git a/check.py b/check.py --- a/check.py +++ b/check.py @@ -244,7 +244,14 @@ } view(state, t, styles) while True: - key = t.getkey() # Wait for the next keypress... + try: + key = t.getkey() # Wait for the next keypress... + except Exception as e: + if e.args[0] == 'no input': + # This error is raised when I press e.g. Win+Left and the + # window manager moves the terminal window. Ignore it. + continue + raise state = update(state, key) # ...update state based on the key... view(state, t, styles) # ...render the new state... state = autoupdate_state_no_rerender(state) # ...and do housekeeping.