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
d700e597
Commit
d700e597
authored
10 years ago
by
Jean Chalard
Committed by
Android (Google) Code Review
10 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Some cleanup to accommodate a fix"
parents
132bdd07
debe0dac
No related branches found
Branches containing commit
No related tags found
Tags containing commit
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
+12
-7
12 additions, 7 deletions
.../com/android/inputmethod/latin/inputlogic/InputLogic.java
with
12 additions
and
7 deletions
java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+
12
−
7
View file @
d700e597
...
...
@@ -733,8 +733,7 @@ public final class InputLogic {
sendKeyCodePoint
(
settingsValues
,
codePoint
);
if
(
swapWeakSpace
)
{
swapSwapperAndSpace
(
inputTransaction
);
if
(
swapWeakSpace
&&
swapSwapperAndSpace
(
inputTransaction
))
{
mSpaceState
=
SpaceState
.
WEAK
;
}
// In case the "add to dictionary" hint was still displayed.
...
...
@@ -810,8 +809,6 @@ public final class InputLogic {
if
(
Constants
.
CODE_SPACE
==
codePoint
)
{
if
(
maybeDoubleSpacePeriod
(
inputTransaction
))
{
inputTransaction
.
requireShiftUpdate
(
InputTransaction
.
SHIFT_UPDATE_NOW
);
inputTransaction
.
setRequiresUpdateSuggestions
();
mSpaceState
=
SpaceState
.
DOUBLE
;
}
else
if
(!
mSuggestedWords
.
isPunctuationSuggestions
())
{
mSpaceState
=
SpaceState
.
WEAK
;
...
...
@@ -823,8 +820,9 @@ public final class InputLogic {
}
}
else
{
if
(
swapWeakSpace
)
{
swapSwapperAndSpace
(
inputTransaction
);
mSpaceState
=
SpaceState
.
SWAP_PUNCTUATION
;
if
(
swapSwapperAndSpace
(
inputTransaction
))
{
mSpaceState
=
SpaceState
.
SWAP_PUNCTUATION
;
}
}
else
if
((
SpaceState
.
PHANTOM
==
inputTransaction
.
mSpaceState
&&
settingsValues
.
isUsuallyFollowedBySpace
(
codePoint
))
||
(
Constants
.
CODE_DOUBLE_QUOTE
==
codePoint
...
...
@@ -1008,8 +1006,9 @@ public final class InputLogic {
* This method will check that there are two characters before the cursor and that the first
* one is a space before it does the actual swapping.
* @param inputTransaction The transaction in progress.
* @return true if the swap has been performed, false if it was prevented by preliminary checks.
*/
private
void
swapSwapperAndSpace
(
final
InputTransaction
inputTransaction
)
{
private
boolean
swapSwapperAndSpace
(
final
InputTransaction
inputTransaction
)
{
final
CharSequence
lastTwo
=
mConnection
.
getTextBeforeCursor
(
2
,
0
);
// It is guaranteed lastTwo.charAt(1) is a swapper - else this method is not called.
if
(
lastTwo
!=
null
&&
lastTwo
.
length
()
==
2
&&
lastTwo
.
charAt
(
0
)
==
Constants
.
CODE_SPACE
)
{
...
...
@@ -1017,7 +1016,9 @@ public final class InputLogic {
final
String
text
=
lastTwo
.
charAt
(
1
)
+
" "
;
mConnection
.
commitText
(
text
,
1
);
inputTransaction
.
requireShiftUpdate
(
InputTransaction
.
SHIFT_UPDATE_NOW
);
return
true
;
}
return
false
;
}
/*
...
...
@@ -1078,6 +1079,8 @@ public final class InputLogic {
*/
private
boolean
maybeDoubleSpacePeriod
(
final
InputTransaction
inputTransaction
)
{
if
(!
inputTransaction
.
mSettingsValues
.
mUseDoubleSpacePeriod
)
return
false
;
// This can't happen right now because we don't call this method when the code is not space
if
(
Constants
.
CODE_SPACE
!=
inputTransaction
.
mEvent
.
mCodePoint
)
return
false
;
if
(!
isDoubleSpacePeriodCountdownActive
(
inputTransaction
))
return
false
;
// We only do this when we see two spaces and an accepted code point before the cursor.
// The code point may be a surrogate pair but the two spaces may not, so we need 4 chars.
...
...
@@ -1099,6 +1102,8 @@ public final class InputLogic {
final
String
textToInsert
=
inputTransaction
.
mSettingsValues
.
mSpacingAndPunctuations
.
mSentenceSeparatorAndSpace
;
mConnection
.
commitText
(
textToInsert
,
1
);
inputTransaction
.
requireShiftUpdate
(
InputTransaction
.
SHIFT_UPDATE_NOW
);
inputTransaction
.
setRequiresUpdateSuggestions
();
return
true
;
}
return
false
;
...
...
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