am f977ca6c: Merge "[CB21] More refactoring"
* commit 'f977ca6c927ef96393181708355ac874232df291': [CB21] More refactoringmain
commit
3b8b2977a6
|
@ -189,11 +189,6 @@ public final class WordComposer {
|
||||||
newIndex, primaryCode, mIsFirstCharCapitalized);
|
newIndex, primaryCode, mIsFirstCharCapitalized);
|
||||||
if (Character.isUpperCase(primaryCode)) mCapsCount++;
|
if (Character.isUpperCase(primaryCode)) mCapsCount++;
|
||||||
if (Character.isDigit(primaryCode)) mDigitsCount++;
|
if (Character.isDigit(primaryCode)) mDigitsCount++;
|
||||||
if (Constants.CODE_SINGLE_QUOTE == primaryCode) {
|
|
||||||
++mTrailingSingleQuotesCount;
|
|
||||||
} else {
|
|
||||||
mTrailingSingleQuotesCount = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processEvent(final Event event) {
|
private void processEvent(final Event event) {
|
||||||
|
@ -209,6 +204,26 @@ public final class WordComposer {
|
||||||
if (0 == mCodePointSize) {
|
if (0 == mCodePointSize) {
|
||||||
mIsFirstCharCapitalized = false;
|
mIsFirstCharCapitalized = false;
|
||||||
}
|
}
|
||||||
|
if (Constants.CODE_DELETE == event.mKeyCode) {
|
||||||
|
if (mTrailingSingleQuotesCount > 0) {
|
||||||
|
--mTrailingSingleQuotesCount;
|
||||||
|
} else {
|
||||||
|
// Delete, but we didn't end in a quote: must recompute mTrailingSingleQuotesCount
|
||||||
|
// We're only searching for single quotes, so no need to account for code points
|
||||||
|
for (int i = mTypedWordCache.length() - 1; i > 0; --i) {
|
||||||
|
if (Constants.CODE_SINGLE_QUOTE != mTypedWordCache.charAt(i)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++mTrailingSingleQuotesCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Constants.CODE_SINGLE_QUOTE == primaryCode) {
|
||||||
|
++mTrailingSingleQuotesCount;
|
||||||
|
} else {
|
||||||
|
mTrailingSingleQuotesCount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
mAutoCorrection = null;
|
mAutoCorrection = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,18 +232,6 @@ public final class WordComposer {
|
||||||
*/
|
*/
|
||||||
public void deleteLast(final Event event) {
|
public void deleteLast(final Event event) {
|
||||||
processEvent(event);
|
processEvent(event);
|
||||||
if (mTrailingSingleQuotesCount > 0) {
|
|
||||||
--mTrailingSingleQuotesCount;
|
|
||||||
} else {
|
|
||||||
int i = mTypedWordCache.length();
|
|
||||||
while (i > 0) {
|
|
||||||
i = Character.offsetByCodePoints(mTypedWordCache, i, -1);
|
|
||||||
if (Constants.CODE_SINGLE_QUOTE != Character.codePointAt(mTypedWordCache, i)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
++mTrailingSingleQuotesCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCursorPositionWithinWord(final int posWithinWord) {
|
public void setCursorPositionWithinWord(final int posWithinWord) {
|
||||||
|
|
Loading…
Reference in New Issue