Input method indicator should not limit to 2 characters, at least 3 characters should be allowed
See also: https://bugzilla.redhat.com/show_bug.cgi?id=1678386
gnome-shell/js/ui/status/keyboard.js contains:
_buildPropSubMenu(menu, props) {
if (!props)
return;
let ibusManager = IBusManager.getIBusManager();
let radioGroup = [];
let p;
for (let i = 0; (p = props.get(i)) != null; ++i) {
let prop = p;
if (!prop.get_visible())
continue;
if (prop.get_key() == 'InputMode') {
let text;
if (prop.get_symbol)
text = prop.get_symbol().get_text();
else
text = prop.get_label().get_text();
let currentSource = this._inputSourceManager.currentSource;
if (currentSource) {
let indicatorLabel = this._indicatorLabels[currentSource.index];
if (text && text.length > 0 && text.length < 3)
indicatorLabel.set_text(text);
}
}
Here the length of the input method InputMode indicator is limited to 2 characters.
For input methods which don’t have input modes and just display the language name or some characters to identify the input method there, at least 3 characters are possible to display in that place.
So I think when the input mode is displayed there, 3 characters should be allowed as well.
As one can see in the screenshot below, I use LookingGlass to show the length of some strings:
'ab'.length r(0) = 2 '漢字'.length r(1) = 2 '
🚀 '.length r(2) = 2 '🚀 ︎'.length r(3) = 3
Surprisingly, although two Chinese characters still have length 2, all emoji characters seem to have length 2. That means it is only possible to display a single emoji character there, adding U+FE0E to an emoji to select the text representation to get a black and white emoji to fit better into the styling of the gnome panel is not possible.
My guess is that .length just counts the number of words in UTF-16, therefore counting all characters above U+FFFF as 2. One could make a complicated check to for high surrogates and ignore them when counting to count characters abovd U+FFFF correctly as only one character. And also avoid counting invisible characters like the emoji text representation selector.
But I think this is needlessly complicated, I think one should just remove that check for the length limitation altogether. When the initial value for this input method indicator is set, there is no limit to 2 characters either, ibus-typing-booster used to show en-US, en-GB, de-DE, de-AT, ... there when ibus-typing-booster still had one engine per language. So 5 characters are possible to display there as the initial setting, then it doesn’t seem to make sense to enforce a shorter limit for the input mode display there.
Of course one should make that as short as possible.
As ibus-typing-booster is now multilingual in one engine, it does not make sense to display any language codes there, having a list of language codes there would be far too long and look weird.
Actually most input engines don't display language codes there anyway, for example the Japanese engines display a "あ" (Hiragana a) or "_A" when in direct input mode the Chinese engines display "中" when in Chinese mode and "英" when in direct input mode, most if the ibus-m17n engines display a characteristic character for the language they support.
So for a multilingual engine like ibus-typing-booster, it makes sense to display a symbol like the rocket which makes this obviously recognizable.
But to fit better into the style of the gnome panel, it should be
possible to display that rocket symbol in black and white. Displaying
emoji like "
Currently, "
At least 3 characters should be allowed because many languages already have iso codes with 3 letters (like in mai_IN.UTF-8, "mai" has already 3 letters).
I think when two characters like "en" or "_A" are allowed to be displayed as an input mode in the gnome-panel, then two black and white emoji should be allowed as well. With the current way of counting this would meann that one should allow 6 16 bit words, i.e. check for text.length < 7.
But probably it is better to remove that "text.length <" check altogether. The input engines should make sure that whatever they display there is very short.