From 670ad353b2fc301741646d63ff07e015371b8070 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 16 Aug 2023 11:54:50 +0530 Subject: [PATCH] unicode_input kitten: Add an option to specify the startup tab Fixes #6552 --- docs/changelog.rst | 2 ++ kittens/unicode_input/main.go | 21 ++++++++++++++++----- kittens/unicode_input/main.py | 7 +++++++ 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index b9705c7ea..7bce1dc24 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -51,6 +51,8 @@ Detailed list of changes - Remote control: Allow using a random TCP port as the remote control socket and also allow using TCP sockets in :opt:`listen_on` +- unicode_input kitten: Add an option to specify the startup tab (:iss:`6552`) + - X11: Print an error to :file:`STDERR` instead of refusing to start when the user sets a custom window icon larger than 128x128 (:iss:`6507`) 0.29.2 [2023-07-27] diff --git a/kittens/unicode_input/main.go b/kittens/unicode_input/main.go index f656bc747..a6cd5c25c 100644 --- a/kittens/unicode_input/main.go +++ b/kittens/unicode_input/main.go @@ -555,14 +555,25 @@ func run_loop(opts *Options) (lp *loop.Loop, err error) { defer cv.Save() h := handler{recent: cached_data.Recent, lp: lp, emoji_variation: opts.EmojiVariation} - switch cached_data.Mode { - case "HEX": + switch opts.Tab { + case "previous": + switch cached_data.Mode { + case "HEX": + h.mode = HEX + case "NAME": + h.mode = NAME + case "EMOTICONS": + h.mode = EMOTICONS + case "FAVORITES": + h.mode = FAVORITES + } + case "code": h.mode = HEX - case "NAME": + case "name": h.mode = NAME - case "EMOTICONS": + case "emoticons": h.mode = EMOTICONS - case "FAVORITES": + case "favorites": h.mode = FAVORITES } all_modes[0] = ModeData{mode: HEX, title: "Code", key: "F1"} diff --git a/kittens/unicode_input/main.py b/kittens/unicode_input/main.py index d696c98fc..bf1518084 100644 --- a/kittens/unicode_input/main.py +++ b/kittens/unicode_input/main.py @@ -18,6 +18,13 @@ Whether to use the textual or the graphical form for emoji. By default the default form specified in the Unicode standard for the symbol is used. +--tab +type=choices +default=previous +choices=previous,code,name,emoticons,favorites +The initial tab to display. Defaults to using the tab from the previous kitten invocation. + + '''.format