mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-23 07:39:11 +00:00
get suggestions when typing with cursor in front of composing word, fixes #265
This commit is contained in:
parent
43a914f270
commit
d3d1f25c7f
2 changed files with 11 additions and 3 deletions
|
@ -228,6 +228,10 @@ public final class WordComposer {
|
||||||
return mCursorPositionWithinWord != mCodePointSize;
|
return mCursorPositionWithinWord != mCodePointSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCursorInFrontOfComposingWord() {
|
||||||
|
return mCursorPositionWithinWord == 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the cursor is moved by the user, we need to update its position.
|
* When the cursor is moved by the user, we need to update its position.
|
||||||
* If it falls inside the currently composing word, we don't reset the composition, and
|
* If it falls inside the currently composing word, we don't reset the composition, and
|
||||||
|
|
|
@ -931,13 +931,17 @@ public final class InputLogic {
|
||||||
insertAutomaticSpaceIfOptionsAndTextAllow(settingsValues);
|
insertAutomaticSpaceIfOptionsAndTextAllow(settingsValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mWordComposer.isCursorFrontOrMiddleOfComposingWord()) {
|
if (mWordComposer.isCursorInFrontOfComposingWord()) {
|
||||||
|
// we add something in front of the composing word, this is likely for adding something
|
||||||
|
// and not for a correction
|
||||||
|
// keep composing and don't unlearn word in this case
|
||||||
|
resetEntireInputState(mConnection.getExpectedSelectionStart(), mConnection.getExpectedSelectionEnd(), false);
|
||||||
|
} else if (mWordComposer.isCursorFrontOrMiddleOfComposingWord()) {
|
||||||
// If we are in the middle of a recorrection, we need to commit the recorrection
|
// If we are in the middle of a recorrection, we need to commit the recorrection
|
||||||
// first so that we can insert the character at the current cursor position.
|
// first so that we can insert the character at the current cursor position.
|
||||||
// We also need to unlearn the original word that is now being corrected.
|
// We also need to unlearn the original word that is now being corrected.
|
||||||
unlearnWord(mWordComposer.getTypedWord(), inputTransaction.getMSettingsValues(), Constants.EVENT_BACKSPACE);
|
unlearnWord(mWordComposer.getTypedWord(), inputTransaction.getMSettingsValues(), Constants.EVENT_BACKSPACE);
|
||||||
resetEntireInputState(mConnection.getExpectedSelectionStart(),
|
resetEntireInputState(mConnection.getExpectedSelectionStart(), mConnection.getExpectedSelectionEnd(), true);
|
||||||
mConnection.getExpectedSelectionEnd(), true /* clearSuggestionStrip */);
|
|
||||||
isComposingWord = false;
|
isComposingWord = false;
|
||||||
}
|
}
|
||||||
// We want to find out whether to start composing a new word with this character. If so,
|
// We want to find out whether to start composing a new word with this character. If so,
|
||||||
|
|
Loading…
Add table
Reference in a new issue