-
-
Notifications
You must be signed in to change notification settings - Fork 193
Add inline emoji search #1660
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
base: main
Are you sure you want to change the base?
Add inline emoji search #1660
Conversation
Is there any chance we could use space without breaking other stuff? Having to use
Didn't yet test, because a lot of shown emojis are not available on my Android 10 device. But I think it's ok.
Why is it necessary? (I'll wait with review until I'm done with #1542) [Edit] Maybe autocorrect would be an idea? It would be more like select first emoji on exiting search mode, and maybe shouldn't be implemented using the complicated autocorrect logic. |
Agreed on the problem. The other ideas I had were using newline or multiple whitespace as exit indicators, but they seemed unfriendly and the latter brittle. What's your take?
The Lao (Laos) language's locale in HeliBoard is
Good idea. Can we use the existing autocorrect setting or do we need a separate one? |
# Conflicts: # app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.java
Repurposing the action key could work. It could change the icon to clarify the select-emoji action.
Isn't there already something very similar in
Good question. Maybe we can just have it always enabled? |
# Conflicts: # app/src/main/java/helium314/keyboard/latin/RichInputConnection.java # app/src/main/java/helium314/keyboard/latin/utils/TextRange.java
Accept whitespace in emoji search string, and end search with a custom action. Support autocorrect.
Done. Had to change the order of
Yes, but the logic for cached dicts is different. I pushed this logic down to
I used the existing setting. When Done is pressed, if autocorrect is on, the default suggestion is accepted, otherwise the search string is committed.
I moved this change to
|
Auto-show emoji suggestions.
|
Changes:
|
# Conflicts: # app/src/main/java/helium314/keyboard/latin/settings/Defaults.kt # app/src/main/java/helium314/keyboard/latin/settings/Settings.java # app/src/main/java/helium314/keyboard/latin/settings/SettingsValues.java # app/src/main/java/helium314/keyboard/latin/utils/DictionaryInfoUtils.kt # app/src/main/java/helium314/keyboard/settings/screens/PreferencesScreen.kt # app/src/main/res/values/strings.xml
|
Made changes to |
Update test.
Move setting.
|
Replaced calls to |
Reverted, based on this. |
|
Oh, and the whole glide typing process may shows suggestions during input, maybe that should also be emojis? I'm afraid now that we might need to considerably change the approach of getting the suggestions, which is awful at this stage. Unfortunately I also didn't think of trying glide typing earlier... |
|
What are the statistics of glide typing? How often does a user have to pick a correction? How many users use glide typing? Would it be acceptable to not support it for the initial inline emoji search release?
That's an interesting idea. Something like:
It gets complicated with multiple words though - we'd need to try all word combinations. Also, with multiple words, how do we keep track of the inline emoji search state? Since each word gets committed separately, I can't think of any natural way to do that, so we might need to introduce an external state flag, which carries the risk of inconsistencies. |
No idea in general. I guess it very much depends on the language and layout, as probably every language has some frequent words that use similar glide typing gestures.
No idea, and I wouldn't know how to actually find out. Rough guess maybe 30 to 50%?
In principle yes, but in my understanding, adding support for glide typing requires fundamental changes on how to get the suggestions.
The multiple word thing could be an issue. Also I'm not sure whether users would want an emoji preview, or a word. Maybe for the first word it could be an emoji preview, and then just the word?
I think we should make things work the same whether it's one or more words. Anyway, since this PR will take a bit more work I'll remove it from my plans for 3.3.
(I really feel it's necessary for me to only focus on very few thing for now, so no touching anything else) Then find a way to continue here. |
What do you suggest we do for now? For each word, use just the top glide suggestion (the one in composed data), ignoring the rest, and suggest emojis based on that?
Any alternative?
Makes sense. |
Maybe I misunderstand your statement and just for a quick indication, in French-language typography, it's the rule to add a space before a colon. |
|
Thanks for the info. Do you think that a colon following a space is not a good enough marker for starting an inline emoji search then? Should it be space, colon, and then a non-space, as @Helium314 suggested? |
Yes I think it would be preferable to start the inline emoji search with the marker space, colon, and then a non-space compared to just space, colon. |
Full support for cursor moving and deletions. Enter inline search mode only after a colon and a non-space. Fix order of first two suggestions.
I tried this approach, by keeping track of all glide word suggestions and translating the glide suggestion scores to weights such that they sum up to one per glide-typed word. However, I then realized that:
So I ended up using this approach, abandoning the
Done, with a minor twist - as before, the character before the colon can be any non-word character,
This is unrelated - it's about emoji suggestions in regular typing, which is already supported.
This is a catch - we can't tell if the user intended to type a normal word after the colon, or whether they intended to start an emoji search. I guess we can add a setting for this, or rely on #1892 is required for preventing frequent triggering of inline emoji search while typing when the edit box contains an inline emoji search marker sequence. |
|
@eranl when normally entering emojis this works really nice!
|
…sumed()`. Use `isEmoji`.
What do you mean by normally?
I can't reproduce this.
In autocorrect mode, pressing the action key replaces the search string with the first suggestion. However, autocorrect mode was turned off when
When the input is reset, if there is an emoji search start sequence (non-word character, colon, non-white-space character) in the buffer preceding the cursor, emoji search mode is entered. Isn't that what we want? I can see a few possible solutions:
We may also want to change action button icon to ⏹️, 🔙, ✖️, Done, or something similar when autocorrect is off for any reason, to make it clear that you're exiting emoji search mode without selecting any emoji. |
|
Just noticed that typing a time (e.g. 7:34) triggers a search, so I tweaked the search start sequence to be:
|
Entering search mode and some characters (or maybe delete something again or move the cursor), then confirming with the action key.
I'd say it depends. Detecting cases where we don't want it can be tricky. Maybe some characters should stop emoji search mode. Or possibly: prevent emoji search mode from starting, but don't stop it if you're currently in search mode.
Sorry I still haven't fully checked this (and no time right now). In this case, will the emoji search text be deleted, or will it stay? |
My concern is that it might get too complex for users to understand and for developers to maintain. Maybe a search string length limit would be good enough?
There's another factor to consider: typing vs. cursor moving. While typing, we only look for the search-start sequence, and then maintain the search mode. Only when you move the cursor, do we have to look back in the buffer to determine search mode.
It stays. |
Well, we can just leave it and see whether this matches user expectations.
If you can reasonably move logic so unit tests can be used, I'd very much recommend to do so. Otherwise tuning this functionality could become very time consuming.
⏹️ seems good to me. With ✖️ I'd expect the text to be deleted, and 🔙 has way too small text. |
Makes sense.
Let me know if this is what you had in mind.
Done. On my device it's orange, BTW.
What's your take on this? |
Adding focused emoji suggestions for strings preceded by
:.~s in the search string are treated as word separators.Each word is looked up separately, and the suggestions are combined according to their total match against all words.
Includes all characters except white space in the emoji search string when initially typed, in order to support search strings with symbols and multiple words.
However, when restarting a search after moving the cursor etc., only the enclosing word characters are considered, in order to keep it simple. In most cases, the search string will likely be just one word. Is this inconsistency acceptable?
Copied some dictionary support logic from #1542.
Added logic for falling back to a country-less locale when loading a dictionary, which was necessary e.g. for the Lao (Laos) language. Should that logic be moved somewhere else?
Made a minor change to
RichInputConnection.isCursorTouchingWord, so that it doesn't consider emojis as part of a word, in order to support an emoji search right after an existing emoji. This also helps with regular suggestions after an emoji, which are currently missing.Partially addresses #259. More to come...