mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-11-11 09:52:13 +03:00
Use shifted keys to match shortcuts as well
This commit is contained in:
parent
19a3635c64
commit
5ffbee1e8c
@ -1511,11 +1511,14 @@ k('next_layout', 'kitty_mod+l', 'next_layout', _('Next layout'))
|
||||
|
||||
g('shortcuts.fonts') # {{{
|
||||
k('increase_font_size', 'kitty_mod+equal', 'change_font_size all +2.0', _('Increase font size'))
|
||||
k('increase_font_size', 'kitty_mod+plus', 'change_font_size all +2.0', _('Increase font size'), add_to_docs=False)
|
||||
k('increase_font_size', 'kitty_mod+kp_add', 'change_font_size all +2.0', _('Increase font size'), add_to_docs=False)
|
||||
if is_macos:
|
||||
k('increase_font_size', 'cmd+plus', 'change_font_size all +2.0', _('Increase font size'), add_to_docs=False)
|
||||
k('increase_font_size', 'cmd+equal', 'change_font_size all +2.0', _('Increase font size'), add_to_docs=False)
|
||||
k('increase_font_size', 'cmd+shift+equal', 'change_font_size all +2.0', _('Increase font size'), add_to_docs=False)
|
||||
k('decrease_font_size', 'kitty_mod+minus', 'change_font_size all -2.0', _('Decrease font size'))
|
||||
k('decrease_font_size', 'kitty_mod+kp_subtract', 'change_font_size all -2.0', _('Decrease font size'))
|
||||
if is_macos:
|
||||
k('decrease_font_size', 'cmd+minus', 'change_font_size all -2.0', _('Decrease font size'), add_to_docs=False)
|
||||
k('decrease_font_size', 'cmd+shift+minus', 'change_font_size all -2.0', _('Decrease font size'), add_to_docs=False)
|
||||
|
@ -21,6 +21,8 @@ functional_key_name_aliases = {
|
||||
'ARROWRIGHT': 'RIGHT',
|
||||
'ARROWLEFT': 'LEFT',
|
||||
'DEL': 'DELETE',
|
||||
'KP_PLUS': 'KP_ADD',
|
||||
'KP_MINUS': 'KP_SUBTRACT',
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,6 +20,8 @@ def keyboard_mode_name(screen: ScreenType) -> str:
|
||||
def get_shortcut(keymap: Union[KeyMap, SequenceMap], ev: KeyEvent) -> Optional[Union[KeyAction, SubSequenceMap]]:
|
||||
mods = ev.mods & 0b1111
|
||||
ans = keymap.get(SingleKey(mods, False, ev.key))
|
||||
if ans is None and ev.shifted_key and mods & 0b1:
|
||||
ans = keymap.get(SingleKey(mods & 0b1110, False, ev.shifted_key))
|
||||
if ans is None:
|
||||
ans = keymap.get(SingleKey(mods, True, ev.native_key))
|
||||
return ans
|
||||
@ -27,5 +29,11 @@ def get_shortcut(keymap: Union[KeyMap, SequenceMap], ev: KeyEvent) -> Optional[U
|
||||
|
||||
def shortcut_matches(s: SingleKey, ev: KeyEvent) -> bool:
|
||||
mods = ev.mods & 0b1111
|
||||
q = ev.native_key if s.is_native else ev.key
|
||||
return bool(s.mods & 0b1111 == mods & 0b1111 and s.key == q)
|
||||
smods = s.mods & 0b1111
|
||||
if s.is_native:
|
||||
return s.key == ev.native_key and smods == mods
|
||||
if s.key == ev.key and mods == smods:
|
||||
return True
|
||||
if ev.shifted_key and mods & 0b1 and (mods & 0b1110) == smods and ev.shifted_key == s.key:
|
||||
return True
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user