mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-14 22:12:46 +00:00
dont store cursor position when it can be reloaded before actually using the position
should fix #935 also make expected selection start / end private (access still via get methods)
This commit is contained in:
parent
a92d108444
commit
e57e2e8de5
2 changed files with 6 additions and 6 deletions
|
@ -99,12 +99,12 @@ public final class RichInputConnection implements PrivateCommandPerformer {
|
||||||
* It's not really the selection start position: the selection start may not be there yet, and
|
* It's not really the selection start position: the selection start may not be there yet, and
|
||||||
* in some cases, it may never arrive there.
|
* in some cases, it may never arrive there.
|
||||||
*/
|
*/
|
||||||
public int mExpectedSelStart = INVALID_CURSOR_POSITION; // in chars, not code points
|
private int mExpectedSelStart = INVALID_CURSOR_POSITION; // in chars, not code points
|
||||||
/**
|
/**
|
||||||
* The expected selection end. Only differs from mExpectedSelStart if a non-empty selection is
|
* The expected selection end. Only differs from mExpectedSelStart if a non-empty selection is
|
||||||
* expected. The same caveats as mExpectedSelStart apply.
|
* expected. The same caveats as mExpectedSelStart apply.
|
||||||
*/
|
*/
|
||||||
public int mExpectedSelEnd = INVALID_CURSOR_POSITION; // in chars, not code points
|
private int mExpectedSelEnd = INVALID_CURSOR_POSITION; // in chars, not code points
|
||||||
/**
|
/**
|
||||||
* This contains the committed text immediately preceding the cursor and the composing
|
* This contains the committed text immediately preceding the cursor and the composing
|
||||||
* text, if any. It is refreshed when the cursor moves by calling upon the TextView.
|
* text, if any. It is refreshed when the cursor moves by calling upon the TextView.
|
||||||
|
|
|
@ -923,7 +923,7 @@ public final class InputLogic {
|
||||||
final CharSequence text = mConnection.textBeforeCursorUntilLastWhitespaceOrDoubleSlash();
|
final CharSequence text = mConnection.textBeforeCursorUntilLastWhitespaceOrDoubleSlash();
|
||||||
final TextRange range = new TextRange(text, 0, text.length(), text.length(), false);
|
final TextRange range = new TextRange(text, 0, text.length(), text.length(), false);
|
||||||
isComposingWord = true;
|
isComposingWord = true;
|
||||||
restartSuggestions(range, mConnection.mExpectedSelStart);
|
restartSuggestions(range);
|
||||||
}
|
}
|
||||||
// TODO: remove isWordConnector() and use isUsuallyFollowedBySpace() instead.
|
// TODO: remove isWordConnector() and use isUsuallyFollowedBySpace() instead.
|
||||||
// See onStartBatchInput() to see how to do it.
|
// See onStartBatchInput() to see how to do it.
|
||||||
|
@ -1670,7 +1670,6 @@ public final class InputLogic {
|
||||||
mSuggestionStripViewAccessor.setNeutralSuggestionStrip();
|
mSuggestionStripViewAccessor.setNeutralSuggestionStrip();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final int expectedCursorPosition = mConnection.getExpectedSelectionStart();
|
|
||||||
if (!mConnection.isCursorTouchingWord(settingsValues.mSpacingAndPunctuations, true /* checkTextAfter */)) {
|
if (!mConnection.isCursorTouchingWord(settingsValues.mSpacingAndPunctuations, true /* checkTextAfter */)) {
|
||||||
// Show predictions.
|
// Show predictions.
|
||||||
mWordComposer.setCapitalizedModeAtStartComposingTime(WordComposer.CAPS_MODE_OFF);
|
mWordComposer.setCapitalizedModeAtStartComposingTime(WordComposer.CAPS_MODE_OFF);
|
||||||
|
@ -1700,11 +1699,12 @@ public final class InputLogic {
|
||||||
mConnection.finishComposingText();
|
mConnection.finishComposingText();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
restartSuggestions(range, expectedCursorPosition);
|
restartSuggestions(range);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restartSuggestions(final TextRange range, final int expectedCursorPosition) {
|
private void restartSuggestions(final TextRange range) {
|
||||||
final int numberOfCharsInWordBeforeCursor = range.getNumberOfCharsInWordBeforeCursor();
|
final int numberOfCharsInWordBeforeCursor = range.getNumberOfCharsInWordBeforeCursor();
|
||||||
|
final int expectedCursorPosition = mConnection.getExpectedSelectionStart();
|
||||||
if (numberOfCharsInWordBeforeCursor > expectedCursorPosition) return;
|
if (numberOfCharsInWordBeforeCursor > expectedCursorPosition) return;
|
||||||
final ArrayList<SuggestedWordInfo> suggestions = new ArrayList<>();
|
final ArrayList<SuggestedWordInfo> suggestions = new ArrayList<>();
|
||||||
final String typedWordString = range.mWord.toString();
|
final String typedWordString = range.mWord.toString();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue