Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
1b3a142c
Commit
1b3a142c
authored
11 years ago
by
Jean Chalard
Committed by
Android (Google) Code Review
11 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Fix a bug where suggestions would not be updated."
parents
a118d19f
6f50c958
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+33
-14
33 additions, 14 deletions
.../com/android/inputmethod/latin/inputlogic/InputLogic.java
with
33 additions
and
14 deletions
java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+
33
−
14
View file @
1b3a142c
...
...
@@ -330,7 +330,13 @@ public final class InputLogic {
// Another option would be to send suggestions each time we set the composing
// text, but that is probably too expensive to do, so we decided to leave things
// as is.
resetEntireInputState
(
settingsValues
,
newSelStart
,
newSelEnd
);
// Also, we're posting a resume suggestions message, and this will update the
// suggestions strip in a few milliseconds, so if we cleared the suggestion strip here
// we'd have the suggestion strip noticeably janky. To avoid that, we don't clear
// it here, which means we'll keep outdated suggestions for a split second but the
// visual result is better.
resetEntireInputState
(
settingsValues
,
newSelStart
,
newSelEnd
,
false
/* clearSuggestionStrip */
);
}
else
{
// resetEntireInputState calls resetCachesUponCursorMove, but forcing the
// composition to end. But in all cases where we don't reset the entire input
...
...
@@ -498,7 +504,7 @@ public final class InputLogic {
// If we are in the middle of a recorrection, we need to commit the recorrection
// first so that we can insert the batch input at the current cursor position.
resetEntireInputState
(
settingsValues
,
mConnection
.
getExpectedSelectionStart
(),
mConnection
.
getExpectedSelectionEnd
());
mConnection
.
getExpectedSelectionEnd
()
,
true
/* clearSuggestionStrip */
);
}
else
if
(
wordComposerSize
<=
1
)
{
// We auto-correct the previous (typed, not gestured) string iff it's one character
// long. The reason for this is, even in the middle of gesture typing, you'll still
...
...
@@ -651,7 +657,7 @@ public final class InputLogic {
// 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.
resetEntireInputState
(
settingsValues
,
mConnection
.
getExpectedSelectionStart
(),
mConnection
.
getExpectedSelectionEnd
());
mConnection
.
getExpectedSelectionEnd
()
,
true
/* clearSuggestionStrip */
);
}
else
{
commitTyped
(
settingsValues
,
LastComposedWord
.
NOT_A_SEPARATOR
);
}
...
...
@@ -693,7 +699,7 @@ public final class InputLogic {
// 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.
resetEntireInputState
(
settingsValues
,
mConnection
.
getExpectedSelectionStart
(),
mConnection
.
getExpectedSelectionEnd
());
mConnection
.
getExpectedSelectionEnd
()
,
true
/* clearSuggestionStrip */
);
isComposingWord
=
false
;
}
// We want to find out whether to start composing a new word with this character. If so,
...
...
@@ -775,7 +781,7 @@ public final class InputLogic {
// If we are in the middle of a recorrection, we need to commit the recorrection
// first so that we can insert the separator at the current cursor position.
resetEntireInputState
(
settingsValues
,
mConnection
.
getExpectedSelectionStart
(),
mConnection
.
getExpectedSelectionEnd
());
mConnection
.
getExpectedSelectionEnd
()
,
true
/* clearSuggestionStrip */
);
}
// isComposingWord() may have changed since we stored wasComposing
if
(
mWordComposer
.
isComposingWord
())
{
...
...
@@ -881,7 +887,7 @@ public final class InputLogic {
// If we are in the middle of a recorrection, we need to commit the recorrection
// first so that we can remove the character at the current cursor position.
resetEntireInputState
(
settingsValues
,
mConnection
.
getExpectedSelectionStart
(),
mConnection
.
getExpectedSelectionEnd
());
mConnection
.
getExpectedSelectionEnd
()
,
true
/* clearSuggestionStrip */
);
// When we exit this if-clause, mWordComposer.isComposingWord() will return false.
}
if
(
mWordComposer
.
isComposingWord
())
{
...
...
@@ -1252,18 +1258,28 @@ public final class InputLogic {
// HACK: We may want to special-case some apps that exhibit bad behavior in case of
// recorrection. This is a temporary, stopgap measure that will be removed later.
// TODO: remove this.
if
(
settingsValues
.
isBrokenByRecorrection
()
)
return
;
if
(
settingsValues
.
isBrokenByRecorrection
()
// Recorrection is not supported in languages without spaces because we don't know
// how to segment them yet.
if
(
!
settingsValues
.
mSpacingAndPunctuations
.
mCurrentLanguageHasSpaces
)
return
;
||
!
settingsValues
.
mSpacingAndPunctuations
.
mCurrentLanguageHasSpaces
// If no suggestions are requested, don't try restarting suggestions.
if
(
!
settingsValues
.
isSuggestionsRequested
()
)
return
;
||
!
settingsValues
.
isSuggestionsRequested
()
// If the cursor is not touching a word, or if there is a selection, return right away.
if
(
mConnection
.
hasSelection
()
)
return
;
||
mConnection
.
hasSelection
()
// If we don't know the cursor location, return.
if
(
mConnection
.
getExpectedSelectionStart
()
<
0
)
return
;
||
mConnection
.
getExpectedSelectionStart
()
<
0
)
{
mSuggestionStripViewAccessor
.
setNeutralSuggestionStrip
();
return
;
}
final
int
expectedCursorPosition
=
mConnection
.
getExpectedSelectionStart
();
if
(!
mConnection
.
isCursorTouchingWord
(
settingsValues
.
mSpacingAndPunctuations
))
return
;
if
(!
mConnection
.
isCursorTouchingWord
(
settingsValues
.
mSpacingAndPunctuations
))
{
// Show predictions.
mWordComposer
.
setCapitalizedModeAndPreviousWordAtStartComposingTime
(
WordComposer
.
CAPS_MODE_OFF
,
getNthPreviousWordForSuggestion
(
settingsValues
.
mSpacingAndPunctuations
,
1
));
mLatinIME
.
mHandler
.
postUpdateSuggestionStrip
();
return
;
}
final
TextRange
range
=
mConnection
.
getWordRangeAtCursor
(
settingsValues
.
mSpacingAndPunctuations
.
mSortedWordSeparators
,
0
/* additionalPrecedingWordsCount */
);
...
...
@@ -1606,14 +1622,17 @@ public final class InputLogic {
* @param settingsValues the current values of the settings.
* @param newSelStart the new selection start, in java characters.
* @param newSelEnd the new selection end, in java characters.
* @param clearSuggestionStrip whether this method should clear the suggestion strip.
*/
// TODO: how is this different from startInput ?!
// TODO: remove all references to this in LatinIME and make this private
public
void
resetEntireInputState
(
final
SettingsValues
settingsValues
,
final
int
newSelStart
,
final
int
newSelEnd
)
{
final
int
newSelStart
,
final
int
newSelEnd
,
final
boolean
clearSuggestionStrip
)
{
final
boolean
shouldFinishComposition
=
mWordComposer
.
isComposingWord
();
resetComposingState
(
true
/* alsoResetLastComposedWord */
);
mSuggestionStripViewAccessor
.
setNeutralSuggestionStrip
();
if
(
clearSuggestionStrip
)
{
mSuggestionStripViewAccessor
.
setNeutralSuggestionStrip
();
}
mConnection
.
resetCachesUponCursorMoveAndReturnSuccess
(
newSelStart
,
newSelEnd
,
shouldFinishComposition
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment