From 57e6e7b2c5b8dcc3760b3480b2051c7c48ece966 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 26 Jun 2020 12:29:42 +0530 Subject: [PATCH] Use ctrl+[] for changing tabs in unicode input as ctrl+tab is taken on macOS ctrl+tab remains in addition for backwards compat --- docs/kittens/unicode-input.rst | 2 +- kittens/unicode_input/main.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/kittens/unicode-input.rst b/docs/kittens/unicode-input.rst index 73ad43cbb..a2991a91e 100644 --- a/docs/kittens/unicode-input.rst +++ b/docs/kittens/unicode-input.rst @@ -24,7 +24,7 @@ a leading period and the index for the match if you don't like to use arrow keys. You can switch between modes using either the function keys or by pressing -:kbd:`Ctrl+Tab` and :kbd:`Ctrl+Shift+Tab`. +:kbd:`Ctrl+[` and :kbd:`Ctrl+]`. Command Line Interface diff --git a/kittens/unicode_input/main.py b/kittens/unicode_input/main.py index f05fadf61..6cf6ea116 100644 --- a/kittens/unicode_input/main.py +++ b/kittens/unicode_input/main.py @@ -20,7 +20,7 @@ from kitty.config import cached_values_for from kitty.constants import config_dir from kitty.fast_data_types import is_emoji_presentation_base, wcswidth from kitty.key_encoding import ( - CTRL, RELEASE, SHIFT, KeyEvent, enter_key, key_defs as K + CTRL, PRESS, RELEASE, SHIFT, KeyEvent, enter_key, key_defs as K ) from kitty.typing import BossType from kitty.utils import ScreenSize, get_editor @@ -38,6 +38,8 @@ UP = K['UP'] DOWN = K['DOWN'] LEFT = K['LEFT'] RIGHT = K['RIGHT'] +RIGHT_BRACKET = K['RIGHT_BRACKET'] +LEFT_BRACKET = K['LEFT_BRACKET'] TAB = K['TAB'] ESCAPE = K['ESCAPE'] F1 = K['F1'] @@ -478,7 +480,7 @@ class UnicodeInput(Handler): return if key_event is enter_key: self.quit_loop(0) - elif key_event.type is RELEASE: + elif key_event.type is PRESS: if not key_event.mods: if key_event.key is ESCAPE: self.quit_loop(1) @@ -492,8 +494,8 @@ class UnicodeInput(Handler): self.switch_mode(FAVORITES) elif key_event.key is F12 and self.mode is FAVORITES: self.edit_favorites() - elif key_event.mods == CTRL and key_event.key is TAB: - self.next_mode() + elif key_event.mods == CTRL and key_event.key in (TAB, RIGHT_BRACKET, LEFT_BRACKET): + self.next_mode(-1 if key_event.key is LEFT_BRACKET else 1) elif key_event.mods == CTRL | SHIFT and key_event.key is TAB: self.next_mode(-1)