More elegant handling for pressing enter with no valid current input in the hints kitten
This commit is contained in:
parent
18893f86ce
commit
26df57a1c7
@ -128,8 +128,14 @@ class Hints(Handler):
|
|||||||
self.current_text = None
|
self.current_text = None
|
||||||
self.draw_screen()
|
self.draw_screen()
|
||||||
elif key_event is enter_key and self.current_input:
|
elif key_event is enter_key and self.current_input:
|
||||||
|
try:
|
||||||
idx = decode_hint(self.current_input)
|
idx = decode_hint(self.current_input)
|
||||||
self.chosen = self.index_map[idx].text
|
self.chosen = self.index_map[idx].text
|
||||||
|
except Exception:
|
||||||
|
self.current_input = ''
|
||||||
|
self.current_text = None
|
||||||
|
self.draw_screen()
|
||||||
|
else:
|
||||||
self.quit_loop(0)
|
self.quit_loop(0)
|
||||||
elif key_event.key is ESCAPE:
|
elif key_event.key is ESCAPE:
|
||||||
self.quit_loop(1)
|
self.quit_loop(1)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user