1
0
Fork 0

fixed inconsistencies with accepting words (there should be no functional changes)

This commit is contained in:
sspanak 2025-04-12 20:04:26 +03:00 committed by Dimo Karaivanov
parent ef7c5476a5
commit 29be10ea68
3 changed files with 8 additions and 6 deletions

View file

@ -223,7 +223,7 @@ class ModeCheonjiin extends InputMode {
protected boolean loadEmojis() {
if (shouldDisplayEmojis()) {
suggestions.clear();
suggestions.addAll(new EmojiLanguage().getKeyCharacters(digitSequence.charAt(0) - '0', getEmojiGroup()));
suggestions.addAll(new EmojiLanguage().getKeyCharacters(digitSequence.charAt(digitSequence.length() - 1) - '0', getEmojiGroup()));
return true;
}
@ -264,7 +264,7 @@ class ModeCheonjiin extends InputMode {
}
// ... otherwise display our custom first groups, if available
int number = digitSequence.isEmpty() ? Integer.MAX_VALUE : digitSequence.charAt(0) - '0';
int number = digitSequence.isEmpty() ? Integer.MAX_VALUE : digitSequence.charAt(digitSequence.length() - 1) - '0';
if (KEY_CHARACTERS.size() > number) {
suggestions.clear();
suggestions.addAll(KEY_CHARACTERS.get(number));

View file

@ -6,11 +6,13 @@ import io.github.sspanak.tt9.hacks.InputType;
import io.github.sspanak.tt9.ime.helpers.TextField;
import io.github.sspanak.tt9.languages.Language;
import io.github.sspanak.tt9.languages.LanguageKind;
import io.github.sspanak.tt9.languages.NaturalLanguage;
import io.github.sspanak.tt9.preferences.settings.SettingsStore;
import io.github.sspanak.tt9.util.chars.Characters;
public class ModePinyin extends ModeIdeograms {
boolean ignoreNextSpace = false;
private final int SPECIAL_CHAR_KEY = NaturalLanguage.SPECIAL_CHAR_KEY.charAt(0) - '0';
private boolean ignoreNextSpace = false;
protected ModePinyin(SettingsStore settings, Language lang, InputType inputType, TextField textField) {
@ -42,7 +44,7 @@ public class ModePinyin extends ModeIdeograms {
@Override
protected void onNumberPress(int number) {
if (ignoreNextSpace && number == SPECIAL_CHAR_SEQUENCE.charAt(0) - '0') {
if (ignoreNextSpace && number == SPECIAL_CHAR_KEY) {
ignoreNextSpace = false;
return;
}
@ -62,7 +64,7 @@ public class ModePinyin extends ModeIdeograms {
@Override
public boolean shouldAcceptPreviousSuggestion(int nextKey, boolean hold) {
// In East Asian languages, 0-key must accept the current word, or type a space when there is no word.
if (!digitSequence.isEmpty() && !digitSequence.endsWith(SPECIAL_CHAR_SEQUENCE) && nextKey == SPECIAL_CHAR_SEQUENCE.charAt(0) - '0') {
if (!digitSequence.isEmpty() && !digitSequence.endsWith(SPECIAL_CHAR_SEQUENCE) && nextKey == SPECIAL_CHAR_KEY) {
ignoreNextSpace = true;
}

View file

@ -403,7 +403,7 @@ class ModeWords extends ModeCheonjiin {
return true;
}
final char SPECIAL_CHAR_KEY_CODE = SPECIAL_CHAR_SEQUENCE.charAt(0);
final char SPECIAL_CHAR_KEY_CODE = SPECIAL_CHAR_SEQUENCE.charAt(SPECIAL_CHAR_SEQUENCE.length() - 1);
final int SPECIAL_CHAR_KEY = SPECIAL_CHAR_KEY_CODE - '0';
// Prevent typing the preferred character when the user has scrolled the special char suggestions.