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
dd5e1d15
Commit
dd5e1d15
authored
13 years ago
by
Jean Chalard
Committed by
Android (Google) Code Review
13 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Remove mCommittedWordSavedForSuggestionResuming (A4)"
parents
3c09bb18
2712f23a
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
+2
-2
2 additions, 2 deletions
java/src/com/android/inputmethod/latin/LatinIME.java
java/src/com/android/inputmethod/latin/WordComposer.java
+13
-23
13 additions, 23 deletions
java/src/com/android/inputmethod/latin/WordComposer.java
with
15 additions
and
25 deletions
java/src/com/android/inputmethod/latin/LatinIME.java
+
2
−
2
View file @
dd5e1d15
...
@@ -2165,7 +2165,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
...
@@ -2165,7 +2165,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// "ic" must not be null
// "ic" must not be null
private
void
cancelAutoCorrect
(
final
InputConnection
ic
)
{
private
void
cancelAutoCorrect
(
final
InputConnection
ic
)
{
mWordComposer
.
resumeSuggestionOn
Kept
Word
(
);
mWordComposer
.
resumeSuggestionOn
LastComposedWord
(
mLastComposed
Word
);
final
String
originallyTypedWord
=
mWordComposer
.
getTypedWord
();
final
String
originallyTypedWord
=
mWordComposer
.
getTypedWord
();
final
CharSequence
autoCorrectedTo
=
mWordComposer
.
getAutoCorrectionOrNull
();
final
CharSequence
autoCorrectedTo
=
mWordComposer
.
getAutoCorrectionOrNull
();
final
int
cancelLength
=
autoCorrectedTo
.
length
();
final
int
cancelLength
=
autoCorrectedTo
.
length
();
...
@@ -2205,7 +2205,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
...
@@ -2205,7 +2205,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// Note: in the interest of code simplicity, we may want to just call
// Note: in the interest of code simplicity, we may want to just call
// restartSuggestionsOnWordBeforeCursorIfAtEndOfWord instead, but retrieving
// restartSuggestionsOnWordBeforeCursorIfAtEndOfWord instead, but retrieving
// the old WordComposer allows to reuse the actual typed coordinates.
// the old WordComposer allows to reuse the actual typed coordinates.
mWordComposer
.
resumeSuggestionOn
Kept
Word
(
);
mWordComposer
.
resumeSuggestionOn
LastComposedWord
(
mLastComposed
Word
);
// We resume suggestion, and then we want to set the composing text to the content
// We resume suggestion, and then we want to set the composing text to the content
// of the word composer again. But since we just manually picked a word, there is
// of the word composer again. But since we just manually picked a word, there is
// no composing text at the moment, so we have to delete the word before we set a
// no composing text at the moment, so we have to delete the word before we set a
...
...
This diff is collapsed.
Click to expand it.
java/src/com/android/inputmethod/latin/WordComposer.java
+
13
−
23
View file @
dd5e1d15
...
@@ -67,8 +67,6 @@ public class WordComposer {
...
@@ -67,8 +67,6 @@ public class WordComposer {
// The currently typing word. May not be null.
// The currently typing word. May not be null.
private
CharacterStore
mCurrentWord
;
private
CharacterStore
mCurrentWord
;
// The information being kept for resuming suggestion. May be null if wiped.
private
CharacterStore
mCommittedWordSavedForSuggestionResuming
;
private
int
mCapsCount
;
private
int
mCapsCount
;
...
@@ -83,7 +81,6 @@ public class WordComposer {
...
@@ -83,7 +81,6 @@ public class WordComposer {
public
WordComposer
()
{
public
WordComposer
()
{
mCurrentWord
=
new
CharacterStore
();
mCurrentWord
=
new
CharacterStore
();
mCommittedWordSavedForSuggestionResuming
=
null
;
mTrailingSingleQuotesCount
=
0
;
mTrailingSingleQuotesCount
=
0
;
}
}
...
@@ -93,7 +90,6 @@ public class WordComposer {
...
@@ -93,7 +90,6 @@ public class WordComposer {
public
void
init
(
WordComposer
source
)
{
public
void
init
(
WordComposer
source
)
{
mCurrentWord
=
new
CharacterStore
(
source
.
mCurrentWord
);
mCurrentWord
=
new
CharacterStore
(
source
.
mCurrentWord
);
mCommittedWordSavedForSuggestionResuming
=
source
.
mCommittedWordSavedForSuggestionResuming
;
mCapsCount
=
source
.
mCapsCount
;
mCapsCount
=
source
.
mCapsCount
;
mIsFirstCharCapitalized
=
source
.
mIsFirstCharCapitalized
;
mIsFirstCharCapitalized
=
source
.
mIsFirstCharCapitalized
;
mAutoCapitalized
=
source
.
mAutoCapitalized
;
mAutoCapitalized
=
source
.
mAutoCapitalized
;
...
@@ -105,7 +101,6 @@ public class WordComposer {
...
@@ -105,7 +101,6 @@ public class WordComposer {
*/
*/
public
void
reset
()
{
public
void
reset
()
{
mCurrentWord
.
reset
();
mCurrentWord
.
reset
();
mCommittedWordSavedForSuggestionResuming
=
null
;
mCapsCount
=
0
;
mCapsCount
=
0
;
mIsFirstCharCapitalized
=
false
;
mIsFirstCharCapitalized
=
false
;
mTrailingSingleQuotesCount
=
0
;
mTrailingSingleQuotesCount
=
0
;
...
@@ -201,7 +196,6 @@ public class WordComposer {
...
@@ -201,7 +196,6 @@ public class WordComposer {
int
codePoint
=
word
.
charAt
(
i
);
int
codePoint
=
word
.
charAt
(
i
);
addKeyInfo
(
codePoint
,
keyboard
,
keyDetector
);
addKeyInfo
(
codePoint
,
keyboard
,
keyDetector
);
}
}
mCommittedWordSavedForSuggestionResuming
=
null
;
}
}
/**
/**
...
@@ -331,7 +325,6 @@ public class WordComposer {
...
@@ -331,7 +325,6 @@ public class WordComposer {
// `type' should be one of the LastComposedWord.COMMIT_TYPE_* constants above.
// `type' should be one of the LastComposedWord.COMMIT_TYPE_* constants above.
public
LastComposedWord
commitWord
(
final
int
type
)
{
public
LastComposedWord
commitWord
(
final
int
type
)
{
mCommittedWordSavedForSuggestionResuming
=
mCurrentWord
;
// Note: currently, we come here whenever we commit a word. If it's any *other* kind than
// Note: currently, we come here whenever we commit a word. If it's any *other* kind than
// DECIDED_WORD, we should reset mAutoCorrection so that we don't attempt to cancel later.
// DECIDED_WORD, we should reset mAutoCorrection so that we don't attempt to cancel later.
// If it's a DECIDED_WORD, it may be an actual auto-correction by the IME, or what the user
// If it's a DECIDED_WORD, it may be an actual auto-correction by the IME, or what the user
...
@@ -339,29 +332,26 @@ public class WordComposer {
...
@@ -339,29 +332,26 @@ public class WordComposer {
// Ideally we would also null it when it was a DECIDED_WORD that was not an auto-correct.
// Ideally we would also null it when it was a DECIDED_WORD that was not an auto-correct.
// As it happens these two cases should behave differently, because the former can be
// As it happens these two cases should behave differently, because the former can be
// canceled while the latter can't. Currently, we figure this out in
// canceled while the latter can't. Currently, we figure this out in
// #didAutoCorrectToAnotherWord with #equals(). It would be marginally cleaner to do it
// LastComposedWord#didAutoCorrectToAnotherWord with #equals(). It would be marginally
// here, but it would be slower (since we would #equals() for each commit, instead of
// cleaner to do it here, but it would be slower (since we would #equals() for each commit,
// only on cancel), and ultimately we want to figure it out even earlier anyway.
// instead of only on cancel), and ultimately we want to figure it out even earlier anyway.
if
(
type
!=
LastComposedWord
.
COMMIT_TYPE_DECIDED_WORD
)
{
// Only ever revert an auto-correct.
mCommittedWordSavedForSuggestionResuming
.
mAutoCorrection
=
null
;
}
final
LastComposedWord
lastComposedWord
=
new
LastComposedWord
(
type
,
mCurrentWord
.
mCodes
,
final
LastComposedWord
lastComposedWord
=
new
LastComposedWord
(
type
,
mCurrentWord
.
mCodes
,
mCurrentWord
.
mXCoordinates
,
mCurrentWord
.
mYCoordinates
,
mCurrentWord
.
mXCoordinates
,
mCurrentWord
.
mYCoordinates
,
mCurrentWord
.
mTypedWord
.
toString
(),
mCurrentWord
.
mTypedWord
.
toString
(),
null
==
mCurrentWord
.
mAutoCorrection
(
type
!=
LastComposedWord
.
COMMIT_TYPE_DECIDED_WORD
)
?
null
:
mCurrentWord
.
mAutoCorrection
.
toString
());
||
(
null
==
mCurrentWord
.
mAutoCorrection
)
?
null
:
mCurrentWord
.
mAutoCorrection
.
toString
());
// TODO: improve performance by swapping buffers instead of creating a new object.
// TODO: improve performance by swapping buffers instead of creating a new object.
mCurrentWord
=
new
CharacterStore
();
mCurrentWord
=
new
CharacterStore
();
return
lastComposedWord
;
return
lastComposedWord
;
}
}
public
boolean
hasWordKeptForSuggestionResuming
(
)
{
public
void
resumeSuggestionOnLastComposedWord
(
final
LastComposedWord
lastComposedWord
)
{
return
null
!=
mCommittedWordSavedForSuggestionResuming
;
mCurrentWord
.
mCodes
=
lastComposedWord
.
mCodes
;
}
mCurrentWord
.
mXCoordinates
=
lastComposedWord
.
mXCoordinates
;
mCurrentWord
.
mYCoordinates
=
lastComposedWord
.
mYCoordinates
;
public
void
resumeSuggestionOnKeptWord
()
{
mCurrentWord
.
mTypedWord
.
setLength
(
0
);
mCurrentWord
=
mCommittedWordSavedForSuggestionResuming
;
mCurrentWord
.
mTypedWord
.
append
(
lastComposedWord
.
mTypedWord
)
;
mC
ommittedWordSavedForSuggestionResuming
=
null
;
mC
urrentWord
.
mAutoCorrection
=
lastComposedWord
.
mAutoCorrection
;
}
}
}
}
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