mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-26 10:12:17 +02:00
Make the repr of SingleKey shorter
This commit is contained in:
22
kitty/options/types.py
generated
22
kitty/options/types.py
generated
@@ -818,19 +818,19 @@ defaults.map = [
|
|||||||
# open_url
|
# open_url
|
||||||
KeyDefinition(False, (KeyAction('open_url_with_hints'),), 1024, False, 101, ()),
|
KeyDefinition(False, (KeyAction('open_url_with_hints'),), 1024, False, 101, ()),
|
||||||
# insert_selected_path
|
# insert_selected_path
|
||||||
KeyDefinition(True, (KeyAction('kitten', ('hints', '--type', 'path', '--program', '-')),), 1024, False, 112, (SingleKey(mods=0, is_native=False, key=102),)),
|
KeyDefinition(True, (KeyAction('kitten', ('hints', '--type', 'path', '--program', '-')),), 1024, False, 112, (SingleKey(key=102),)),
|
||||||
# open_selected_path
|
# open_selected_path
|
||||||
KeyDefinition(True, (KeyAction('kitten', ('hints', '--type', 'path')),), 1024, False, 112, (SingleKey(mods=1, is_native=False, key=102),)),
|
KeyDefinition(True, (KeyAction('kitten', ('hints', '--type', 'path')),), 1024, False, 112, (SingleKey(mods=1, key=102),)),
|
||||||
# insert_selected_line
|
# insert_selected_line
|
||||||
KeyDefinition(True, (KeyAction('kitten', ('hints', '--type', 'line', '--program', '-')),), 1024, False, 112, (SingleKey(mods=0, is_native=False, key=108),)),
|
KeyDefinition(True, (KeyAction('kitten', ('hints', '--type', 'line', '--program', '-')),), 1024, False, 112, (SingleKey(key=108),)),
|
||||||
# insert_selected_word
|
# insert_selected_word
|
||||||
KeyDefinition(True, (KeyAction('kitten', ('hints', '--type', 'word', '--program', '-')),), 1024, False, 112, (SingleKey(mods=0, is_native=False, key=119),)),
|
KeyDefinition(True, (KeyAction('kitten', ('hints', '--type', 'word', '--program', '-')),), 1024, False, 112, (SingleKey(key=119),)),
|
||||||
# insert_selected_hash
|
# insert_selected_hash
|
||||||
KeyDefinition(True, (KeyAction('kitten', ('hints', '--type', 'hash', '--program', '-')),), 1024, False, 112, (SingleKey(mods=0, is_native=False, key=104),)),
|
KeyDefinition(True, (KeyAction('kitten', ('hints', '--type', 'hash', '--program', '-')),), 1024, False, 112, (SingleKey(key=104),)),
|
||||||
# goto_file_line
|
# goto_file_line
|
||||||
KeyDefinition(True, (KeyAction('kitten', ('hints', '--type', 'linenum')),), 1024, False, 112, (SingleKey(mods=0, is_native=False, key=110),)),
|
KeyDefinition(True, (KeyAction('kitten', ('hints', '--type', 'linenum')),), 1024, False, 112, (SingleKey(key=110),)),
|
||||||
# open_selected_hyperlink
|
# open_selected_hyperlink
|
||||||
KeyDefinition(True, (KeyAction('kitten', ('hints', '--type', 'hyperlink')),), 1024, False, 112, (SingleKey(mods=0, is_native=False, key=121),)),
|
KeyDefinition(True, (KeyAction('kitten', ('hints', '--type', 'hyperlink')),), 1024, False, 112, (SingleKey(key=121),)),
|
||||||
# toggle_fullscreen
|
# toggle_fullscreen
|
||||||
KeyDefinition(False, (KeyAction('toggle_fullscreen'),), 1024, False, 57374, ()),
|
KeyDefinition(False, (KeyAction('toggle_fullscreen'),), 1024, False, 57374, ()),
|
||||||
# toggle_maximized
|
# toggle_maximized
|
||||||
@@ -842,13 +842,13 @@ defaults.map = [
|
|||||||
# kitty_shell
|
# kitty_shell
|
||||||
KeyDefinition(False, (KeyAction('kitty_shell', ('window',)),), 1024, False, 57344, ()),
|
KeyDefinition(False, (KeyAction('kitty_shell', ('window',)),), 1024, False, 57344, ()),
|
||||||
# increase_background_opacity
|
# increase_background_opacity
|
||||||
KeyDefinition(True, (KeyAction('set_background_opacity', ('+0.1',)),), 1024, False, 97, (SingleKey(mods=0, is_native=False, key=109),)),
|
KeyDefinition(True, (KeyAction('set_background_opacity', ('+0.1',)),), 1024, False, 97, (SingleKey(key=109),)),
|
||||||
# decrease_background_opacity
|
# decrease_background_opacity
|
||||||
KeyDefinition(True, (KeyAction('set_background_opacity', ('-0.1',)),), 1024, False, 97, (SingleKey(mods=0, is_native=False, key=108),)),
|
KeyDefinition(True, (KeyAction('set_background_opacity', ('-0.1',)),), 1024, False, 97, (SingleKey(key=108),)),
|
||||||
# full_background_opacity
|
# full_background_opacity
|
||||||
KeyDefinition(True, (KeyAction('set_background_opacity', ('1',)),), 1024, False, 97, (SingleKey(mods=0, is_native=False, key=49),)),
|
KeyDefinition(True, (KeyAction('set_background_opacity', ('1',)),), 1024, False, 97, (SingleKey(key=49),)),
|
||||||
# reset_background_opacity
|
# reset_background_opacity
|
||||||
KeyDefinition(True, (KeyAction('set_background_opacity', ('default',)),), 1024, False, 97, (SingleKey(mods=0, is_native=False, key=100),)),
|
KeyDefinition(True, (KeyAction('set_background_opacity', ('default',)),), 1024, False, 97, (SingleKey(key=100),)),
|
||||||
# reset_terminal
|
# reset_terminal
|
||||||
KeyDefinition(False, (KeyAction('clear_terminal', ('reset', True)),), 1024, False, 57349, ()),
|
KeyDefinition(False, (KeyAction('clear_terminal', ('reset', True)),), 1024, False, 57349, ()),
|
||||||
# reload_config_file
|
# reload_config_file
|
||||||
|
|||||||
@@ -52,6 +52,14 @@ class SingleKey(NamedTuple):
|
|||||||
is_native: bool = False
|
is_native: bool = False
|
||||||
key: int = -1
|
key: int = -1
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
kwds = []
|
||||||
|
for i, f in enumerate(self._fields):
|
||||||
|
val = self[i]
|
||||||
|
if val != self._field_defaults[f]:
|
||||||
|
kwds.append(f'{f}={val!r}')
|
||||||
|
return 'SingleKey(' + ', '.join(kwds) + ')'
|
||||||
|
|
||||||
|
|
||||||
class MouseEvent(NamedTuple):
|
class MouseEvent(NamedTuple):
|
||||||
button: int = 0
|
button: int = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user