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
5a73d722
"README.md" did not exist on "961453c3b3a8eb3aefb2cebdbcc315c98c2abbd4"
Commit
5a73d722
authored
12 years ago
by
Jean Chalard
Committed by
Android (Google) Code Review
12 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Refactoring and groundwork to fix a bug with older apps"
parents
a316a159
c3ebf1a4
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
+9
-7
9 additions, 7 deletions
...rc/com/android/inputmethod/latin/RichInputConnection.java
with
9 additions
and
7 deletions
java/src/com/android/inputmethod/latin/RichInputConnection.java
+
9
−
7
View file @
5a73d722
...
@@ -340,13 +340,6 @@ public class RichInputConnection {
...
@@ -340,13 +340,6 @@ public class RichInputConnection {
* Returns the word before the cursor if the cursor is at the end of a word, null otherwise
* Returns the word before the cursor if the cursor is at the end of a word, null otherwise
*/
*/
public
CharSequence
getWordBeforeCursorIfAtEndOfWord
(
final
SettingsValues
settings
)
{
public
CharSequence
getWordBeforeCursorIfAtEndOfWord
(
final
SettingsValues
settings
)
{
// Bail out if the cursor is not at the end of a word (cursor must be preceded by
// non-whitespace, non-separator, non-start-of-text)
// Example ("|" is the cursor here) : <SOL>"|a" " |a" " | " all get rejected here.
final
CharSequence
textBeforeCursor
=
getTextBeforeCursor
(
1
,
0
);
if
(
TextUtils
.
isEmpty
(
textBeforeCursor
)
||
settings
.
isWordSeparator
(
textBeforeCursor
.
charAt
(
0
)))
return
null
;
// Bail out if the cursor is in the middle of a word (cursor must be followed by whitespace,
// Bail out if the cursor is in the middle of a word (cursor must be followed by whitespace,
// separator or end of line/text)
// separator or end of line/text)
// Example: "test|"<EOL> "te|st" get rejected here
// Example: "test|"<EOL> "te|st" get rejected here
...
@@ -363,6 +356,15 @@ public class RichInputConnection {
...
@@ -363,6 +356,15 @@ public class RichInputConnection {
word
=
word
.
subSequence
(
1
,
word
.
length
());
word
=
word
.
subSequence
(
1
,
word
.
length
());
}
}
if
(
TextUtils
.
isEmpty
(
word
))
return
null
;
if
(
TextUtils
.
isEmpty
(
word
))
return
null
;
// Find the last code point of the string
final
int
lastCodePoint
=
Character
.
codePointBefore
(
word
,
word
.
length
());
// If for some reason the text field contains non-unicode binary data, or if the
// charsequence is exactly one char long and the contents is a low surrogate, return null.
if
(!
Character
.
isDefined
(
lastCodePoint
))
return
null
;
// Bail out if the cursor is not at the end of a word (cursor must be preceded by
// non-whitespace, non-separator, non-start-of-text)
// Example ("|" is the cursor here) : <SOL>"|a" " |a" " | " all get rejected here.
if
(
settings
.
isWordSeparator
(
lastCodePoint
))
return
null
;
final
char
firstChar
=
word
.
charAt
(
0
);
// we just tested that word is not empty
final
char
firstChar
=
word
.
charAt
(
0
);
// we just tested that word is not empty
if
(
word
.
length
()
==
1
&&
!
Character
.
isLetter
(
firstChar
))
return
null
;
if
(
word
.
length
()
==
1
&&
!
Character
.
isLetter
(
firstChar
))
return
null
;
...
...
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