-
Notifications
You must be signed in to change notification settings - Fork 568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(switches): abbreviate state labels #615
Conversation
YAML config: a switch can have optional string array `abbrev` to define short state labels which do not have to take the first character of the full state labels. (switch_translator): folded options now make use of the short labels defined in the `switches` configuration. (rime_api): add function `get_state_label_abbreviated`, which returns `RimeStringSlice` type since the short label can be the first character of the full label string.
The API querying for short label should better return nothing if it's not defined, instead of returning the first char as default. Because in front end I need a way to tell if user has defined a short label, but if the API return a default value regardlessly, there's no way to tell. And front end might be better in handling extraction of the first character |
What's the exact use case where the front end needs to know whether a short label is defined? API get state label abbreviated: false - labels of unfolded switches; API get state label abbreviated: true - labels of folded switches. Align the two usages so that there are not too many cases to configure. If the first Unicode is not appropriate for short label, define |
I'm imagining 3 modes:
The 3rd option is suitable for cases where the first char of long label doesn't make sense (for example: 傳 for TC). And people upgrading from 0.16.x won't notice any change. |
Formerly we used state labels like 漢字/汉字 to mimic "short" labels instead of being more descriptive. This format is more wide-spread than the 0.16 version. |
Mode 3 means it's up to the schéma author to define which options are displayed short or long. They can implement their preferences using either mode 1 or mode 2. If long label is the dominant case, then define |
Well, that's fine |
Address #608 |
Pull request
Issue tracker
Fixes will automatically close the related issue
Fixes #
Feature
YAML config: a switch can have optional string array
abbrev
to defineshort state labels which do not have to take the first character of the
full state labels.
(switch_translator): folded options now make use of the short labels
defined in the
switches
configuration.(rime_api): add function
get_state_label_abbreviated
, which returnsRimeStringSlice
type since the short label can be the first characterof the full label string.
Unit test
Manual test
Code Review
Additional Info