Skip to content
Snippets Groups Projects
Commit 53196d9e authored by Aleksandras Kostarevas's avatar Aleksandras Kostarevas
Browse files

Disable autocorrect on words starting with a digit

parent f9507b00
No related branches found
No related tags found
No related merge requests found
......@@ -221,7 +221,9 @@ public final class Suggest {
// being active or not
|| wordComposer.isEntirelyDigits()
// If it's an ordinal (1st, 2nd, 3rd), do not autocorrect
|| wordComposer.isOrdinal(locale)
//|| wordComposer.isOrdinal(locale)
// If it starts with a digit, do not autocorrect
|| wordComposer.startsWithDigit()
// If the word is mostly caps, we never auto-correct because this is almost
// certainly intentional (and careful input)
|| wordComposer.isMostlyCaps()
......
......@@ -372,6 +372,13 @@ public final class WordComposer {
return word.matches("^(\\d+)(st|nd|rd|th)$");
}
public boolean startsWithDigit() {
final String word = getTypedWord();
if(word.isEmpty()) return false;
return Character.isDigit(word.charAt(0));
}
/**
* Saves the caps mode at the start of composing.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment