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
943e91ff
Commit
943e91ff
authored
10 years ago
by
Jean Chalard
Committed by
Android (Google) Code Review
10 years ago
Browse files
Options
Downloads
Plain Diff
Merge "[SD6] Inline a constant and remove logic become useless"
parents
3afbac8c
b6695867
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/RichInputConnection.java
+8
-21
8 additions, 21 deletions
...rc/com/android/inputmethod/latin/RichInputConnection.java
with
8 additions
and
21 deletions
java/src/com/android/inputmethod/latin/RichInputConnection.java
+
8
−
21
View file @
943e91ff
...
...
@@ -626,7 +626,6 @@ public final class RichInputConnection {
* @return a range containing the text surrounding the cursor
*/
public
TextRange
getWordRangeAtCursor
(
final
int
[]
sortedSeparators
)
{
final
int
additionalPrecedingWordsCount
=
0
;
mIC
=
mParent
.
getCurrentInputConnection
();
if
(
mIC
==
null
)
{
return
null
;
...
...
@@ -639,29 +638,17 @@ public final class RichInputConnection {
return
null
;
}
// Going backward, alternate skipping non-separators and separators until enough words
// have been read.
int
count
=
additionalPrecedingWordsCount
;
// Going backward, find the first breaking point (separator)
int
startIndexInBefore
=
before
.
length
();
boolean
isStoppingAtWhitespace
=
true
;
// toggles to indicate what to stop at
while
(
true
)
{
// see comments below for why this is guaranteed to halt
while
(
startIndexInBefore
>
0
)
{
final
int
codePoint
=
Character
.
codePointBefore
(
before
,
startIndexInBefore
);
if
(
isStoppingAtWhitespace
==
isSeparator
(
codePoint
,
sortedSeparators
))
{
break
;
// inner loop
}
--
startIndexInBefore
;
if
(
Character
.
isSupplementaryCodePoint
(
codePoint
))
{
--
startIndexInBefore
;
}
while
(
startIndexInBefore
>
0
)
{
final
int
codePoint
=
Character
.
codePointBefore
(
before
,
startIndexInBefore
);
if
(
isSeparator
(
codePoint
,
sortedSeparators
))
{
break
;
}
// isStoppingAtWhitespace is true every other time through the loop,
// so additionalPrecedingWordsCount is guaranteed to become < 0, which
// guarantees outer loop termination
if
(
isStoppingAtWhitespace
&&
(--
count
<
0
))
{
break
;
// outer loop
--
startIndexInBefore
;
if
(
Character
.
isSupplementaryCodePoint
(
codePoint
))
{
--
startIndexInBefore
;
}
isStoppingAtWhitespace
=
!
isStoppingAtWhitespace
;
}
// Find last word separator after the cursor
...
...
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