Skip to content

Commit 2739485

Browse files
committedSep 6, 2021
Added keystroke handler and fixed quitting problems
1 parent c455c40 commit 2739485

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed
 

‎main.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@
1111
"""
1212
import ime
1313

14-
# Create new ImeInstance
15-
editor = ime.ImeInstance(default_buf="Untitled", name="Ime Dev", debug_msg=False)
14+
# keystroke_handler, handle all the keystrokes, is called every time user presses a key
15+
def keystroke_handler(key):
16+
if key == ord('q'):
17+
editor.quit()
1618

17-
# Startup editor
19+
# create ime instance
20+
editor = ime.ImeInstance(keystroke_handler=lambda k: keystroke_handler(k))
21+
22+
# start ime
1823
editor.start()

0 commit comments

Comments
 (0)