1
0
Fork 0

fixed incorrect enforcing of lowercase when typing compound words like 'CD-ROM'

This commit is contained in:
sspanak 2024-08-30 17:17:39 +03:00 committed by Dimo Karaivanov
parent 810ef5bc5d
commit b0d5fb3af3
2 changed files with 6 additions and 4 deletions

View file

@ -384,7 +384,7 @@ public class ModePredictive extends InputMode {
@Override @Override
public void determineNextWordTextCase(String textBeforeCursor) { public void determineNextWordTextCase(String textBeforeCursor) {
textCase = autoTextCase.determineNextWordTextCase(textCase, textFieldTextCase, textBeforeCursor); textCase = autoTextCase.determineNextWordTextCase(textCase, textFieldTextCase, textBeforeCursor, digitSequence);
} }
@Override @Override

View file

@ -41,7 +41,7 @@ public class AutoTextCase {
* For example, this function will return CASE_LOWER by default, but CASE_UPPER at the beginning * For example, this function will return CASE_LOWER by default, but CASE_UPPER at the beginning
* of a sentence. * of a sentence.
*/ */
public int determineNextWordTextCase(int currentTextCase, int textFieldTextCase, String beforeCursor) { public int determineNextWordTextCase(int currentTextCase, int textFieldTextCase, String beforeCursor, String digitSequence) {
if ( if (
// When the setting is off, don't do any changes. // When the setting is off, don't do any changes.
!settings.getAutoTextCase() !settings.getAutoTextCase()
@ -72,8 +72,10 @@ public class AutoTextCase {
return InputMode.CASE_CAPITALIZE; return InputMode.CASE_CAPITALIZE;
} }
// this is mostly for English "I" // This is mostly for English "I", inserted in the middle of a word. However, we don't want to
if (Text.isNextToWord(beforeCursor)) { // enforce lowercase for words like "-ROM" in "CD-ROM". We have to use the digitSequence here,
// because the composing text is not yet set in some cases, when this is called.
if (Text.isNextToWord(beforeCursor) && !digitSequence.startsWith("1")) {
return InputMode.CASE_LOWER; return InputMode.CASE_LOWER;
} }