From 60afa7000f14f8f8ca890236f636d45a2b59b61e Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Thu, 16 Jan 2014 04:32:32 +0900 Subject: Fix a bug specific to German capitalization. Bug: 9663105 Change-Id: Ib68ee4edb135e96dfca229c1ccce308e7e638bdd --- .../com/android/inputmethod/latin/utils/CapsModeUtils.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'java/src/com/android/inputmethod/latin/utils/CapsModeUtils.java') diff --git a/java/src/com/android/inputmethod/latin/utils/CapsModeUtils.java b/java/src/com/android/inputmethod/latin/utils/CapsModeUtils.java index 057e332e9..702688f93 100644 --- a/java/src/com/android/inputmethod/latin/utils/CapsModeUtils.java +++ b/java/src/com/android/inputmethod/latin/utils/CapsModeUtils.java @@ -139,6 +139,20 @@ public final class CapsModeUtils { j--; } if (j <= 0 || Character.isWhitespace(prevChar)) { + if (spacingAndPunctuations.mUsesGermanRules) { + // In German typography rules, there is a specific case that the first character + // of a new line should not be capitalized if the previous line ends in a comma. + boolean hasNewLine = false; + while (--j >= 0 && Character.isWhitespace(prevChar)) { + if (Constants.CODE_ENTER == prevChar) { + hasNewLine = true; + } + prevChar = cs.charAt(j); + } + if (Constants.CODE_COMMA == prevChar && hasNewLine) { + return (TextUtils.CAP_MODE_CHARACTERS | TextUtils.CAP_MODE_WORDS) & reqModes; + } + } // There are only spacing chars between the start of the paragraph and the cursor, // defined as a isWhitespace() char that is neither a isSpaceChar() nor a tab. Both // MODE_WORDS and MODE_SENTENCES should be active. -- cgit v1.2.3-83-g751a