Skip to content

Commit

Permalink
replace constant of suggestion limit
Browse files Browse the repository at this point in the history
  • Loading branch information
codokie committed Apr 10, 2024
1 parent 16cc84a commit 0f4e1cf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ private TextUtils() {
// large enough for all reasonable purposes, but avoid purposeful attacks. 100k sounds about
// right for this.
public static final int MAX_CHARACTERS_FOR_RECAPITALIZATION = 1024 * 100;
// How many characters can a composed word have before it is assumed to be non-suggestible.
// The length of the lengthy word "internationalization" is 20.
public static final int MAX_CHARACTERS_FOR_SUGGESTIONS = 20;

// Key events coming any faster than this are long-presses.
public static final int LONG_PRESS_MILLISECONDS = 200;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import helium314.keyboard.latin.common.StringUtilsKt;
import helium314.keyboard.latin.common.SuggestionSpanUtilsKt;
import helium314.keyboard.latin.define.DebugFlags;
import helium314.keyboard.latin.define.DecoderSpecificConstants;
import helium314.keyboard.latin.settings.SettingsValues;
import helium314.keyboard.latin.settings.SpacingAndPunctuations;
import helium314.keyboard.latin.suggestions.SuggestionStripViewAccessor;
Expand Down Expand Up @@ -1581,7 +1582,7 @@ public void performUpdateSuggestionStripSync(final SettingsValues settingsValues
}

if (!mWordComposer.isComposingWord() && !settingsValues.mBigramPredictionEnabled
|| mWordComposer.size() > Constants.MAX_CHARACTERS_FOR_SUGGESTIONS) {
|| mWordComposer.size() > DecoderSpecificConstants.DICTIONARY_MAX_WORD_LENGTH) {
mSuggestionStripViewAccessor.setNeutralSuggestionStrip();
return;
}
Expand Down Expand Up @@ -2338,7 +2339,7 @@ public void getSuggestedWords(final SettingsValues settingsValues,
final Keyboard keyboard, final int keyboardShiftMode, final int inputStyle,
final int sequenceNumber, final OnGetSuggestedWordsCallback callback) {
// don't get suggestions if composed word is very long
if (mWordComposer.size() > Constants.MAX_CHARACTERS_FOR_SUGGESTIONS) {
if (mWordComposer.size() > DecoderSpecificConstants.DICTIONARY_MAX_WORD_LENGTH) {
callback.onGetSuggestedWords(SuggestedWords.getEmptyInstance());
return;
}
Expand Down

0 comments on commit 0f4e1cf

Please sign in to comment.