mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-21 16:05:02 +02:00
Refactor key encoding
Cannot have key names in global namespace as not all key names are valid python identifiers. So move them into a dict.
This commit is contained in:
@@ -3,7 +3,14 @@
|
||||
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
from kitty.fast_data_types import truncate_point_for_length, wcswidth
|
||||
from kitty.key_encoding import RELEASE, HOME, END, BACKSPACE, DELETE, LEFT, RIGHT
|
||||
from kitty.key_encoding import RELEASE, K
|
||||
|
||||
HOME = K['HOME']
|
||||
END = K['END']
|
||||
BACKSPACE = K['BACKSPACE']
|
||||
DELETE = K['DELETE']
|
||||
LEFT = K['LEFT']
|
||||
RIGHT = K['RIGHT']
|
||||
|
||||
|
||||
class LineEdit:
|
||||
|
||||
@@ -19,8 +19,8 @@ from kitty.fast_data_types import (
|
||||
close_tty, normal_tty, open_tty, parse_input_from_terminal, raw_tty
|
||||
)
|
||||
from kitty.key_encoding import (
|
||||
ALT, CTRL, PRESS, RELEASE, REPEAT, SHIFT, C, D, backspace_key,
|
||||
decode_key_event, enter_key
|
||||
ALT, CTRL, PRESS, RELEASE, REPEAT, SHIFT, backspace_key,
|
||||
decode_key_event, enter_key, K
|
||||
)
|
||||
from kitty.utils import screen_size_function, write_all
|
||||
|
||||
@@ -28,6 +28,9 @@ from .handler import Handler
|
||||
from .operations import init_state, reset_state
|
||||
|
||||
|
||||
C, D = K['C'], K['D']
|
||||
|
||||
|
||||
def debug(*a, **kw):
|
||||
from base64 import standard_b64encode
|
||||
buf = io.StringIO()
|
||||
|
||||
Reference in New Issue
Block a user