mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-09-23 04:29:26 +03:00
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,9 +128,15 @@ def on_key(self, key_event):
|
|||||||
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:
|
||||||
idx = decode_hint(self.current_input)
|
try:
|
||||||
self.chosen = self.index_map[idx].text
|
idx = decode_hint(self.current_input)
|
||||||
self.quit_loop(0)
|
self.chosen = self.index_map[idx].text
|
||||||
|
except Exception:
|
||||||
|
self.current_input = ''
|
||||||
|
self.current_text = None
|
||||||
|
self.draw_screen()
|
||||||
|
else:
|
||||||
|
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…
Reference in New Issue
Block a user