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
5cab0eb7
Commit
5cab0eb7
authored
11 years ago
by
Jean Chalard
Committed by
Android (Google) Code Review
11 years ago
Browse files
Options
Downloads
Plain Diff
Merge "[AC8] Restrict the suggestion strip to the correct part"
parents
ac7e005e
b1e98c2f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
java/src/com/android/inputmethod/latin/LatinIME.java
+1
-0
1 addition, 0 deletions
java/src/com/android/inputmethod/latin/LatinIME.java
java/src/com/android/inputmethod/latin/SuggestedWords.java
+20
-0
20 additions, 0 deletions
java/src/com/android/inputmethod/latin/SuggestedWords.java
with
21 additions
and
0 deletions
java/src/com/android/inputmethod/latin/LatinIME.java
+
1
−
0
View file @
5cab0eb7
...
@@ -1880,6 +1880,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
...
@@ -1880,6 +1880,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final
int
indexOfLastSpace
=
batchInputText
.
lastIndexOf
(
Constants
.
CODE_SPACE
)
+
1
;
final
int
indexOfLastSpace
=
batchInputText
.
lastIndexOf
(
Constants
.
CODE_SPACE
)
+
1
;
if
(
0
!=
indexOfLastSpace
)
{
if
(
0
!=
indexOfLastSpace
)
{
mConnection
.
commitText
(
batchInputText
.
substring
(
0
,
indexOfLastSpace
),
1
);
mConnection
.
commitText
(
batchInputText
.
substring
(
0
,
indexOfLastSpace
),
1
);
showSuggestionStrip
(
suggestedWords
.
getSuggestedWordsForLastWordOfPhraseGesture
());
}
}
final
String
lastWord
=
batchInputText
.
substring
(
indexOfLastSpace
);
final
String
lastWord
=
batchInputText
.
substring
(
indexOfLastSpace
);
mWordComposer
.
setBatchInputWord
(
lastWord
);
mWordComposer
.
setBatchInputWord
(
lastWord
);
...
...
This diff is collapsed.
Click to expand it.
java/src/com/android/inputmethod/latin/SuggestedWords.java
+
20
−
0
View file @
5cab0eb7
...
@@ -276,4 +276,24 @@ public final class SuggestedWords {
...
@@ -276,4 +276,24 @@ public final class SuggestedWords {
false
/* willAutoCorrect */
,
mIsPunctuationSuggestions
,
mIsObsoleteSuggestions
,
false
/* willAutoCorrect */
,
mIsPunctuationSuggestions
,
mIsObsoleteSuggestions
,
mIsPrediction
);
mIsPrediction
);
}
}
// Creates a new SuggestedWordInfo from the currently suggested words that removes all but the
// last word of all suggestions, separated by a space. This is necessary because when we commit
// a multiple-word suggestion, the IME only retains the last word as the composing word, and
// we should only suggest replacements for this last word.
// TODO: make this work with languages without spaces.
public
SuggestedWords
getSuggestedWordsForLastWordOfPhraseGesture
()
{
final
ArrayList
<
SuggestedWordInfo
>
newSuggestions
=
CollectionUtils
.
newArrayList
();
for
(
int
i
=
0
;
i
<
mSuggestedWordInfoList
.
size
();
++
i
)
{
final
SuggestedWordInfo
info
=
mSuggestedWordInfoList
.
get
(
i
);
final
int
indexOfLastSpace
=
info
.
mWord
.
lastIndexOf
(
Constants
.
CODE_SPACE
)
+
1
;
final
String
lastWord
=
info
.
mWord
.
substring
(
indexOfLastSpace
);
newSuggestions
.
add
(
new
SuggestedWordInfo
(
lastWord
,
info
.
mScore
,
info
.
mKind
,
info
.
mSourceDict
,
SuggestedWordInfo
.
NOT_AN_INDEX
,
SuggestedWordInfo
.
NOT_A_CONFIDENCE
));
}
return
new
SuggestedWords
(
newSuggestions
,
mTypedWordValid
,
mWillAutoCorrect
,
mIsPunctuationSuggestions
,
mIsObsoleteSuggestions
,
mIsPrediction
);
}
}
}
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