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
3f7fe829
Commit
3f7fe829
authored
12 years ago
by
Jean Chalard
Committed by
Android (Google) Code Review
12 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Always consider a new line the start of a sentence" into jb-mr1-dev
parents
b24cda3c
2699b45d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
java/src/com/android/inputmethod/latin/StringUtils.java
+9
-5
9 additions, 5 deletions
java/src/com/android/inputmethod/latin/StringUtils.java
tests/src/com/android/inputmethod/latin/StringUtilsTests.java
+8
-0
8 additions, 0 deletions
...s/src/com/android/inputmethod/latin/StringUtilsTests.java
with
17 additions
and
5 deletions
java/src/com/android/inputmethod/latin/StringUtils.java
+
9
−
5
View file @
3f7fe829
...
...
@@ -250,15 +250,19 @@ public final class StringUtils {
// Step 3 : Search for the start of a paragraph. From the starting point computed in step 2,
// we go back over any space or tab char sitting there. We find the start of a paragraph
// if the first char that's not a space or tab is a start of line (as in
, either \n or
//
start of text
).
// if the first char that's not a space or tab is a start of line (as in
\n, start of text,
//
or some other similar characters
).
int
j
=
i
;
char
prevChar
=
Keyboard
.
CODE_SPACE
;
if
(
hasSpaceBefore
)
--
j
;
while
(
j
>
0
&&
Character
.
isWhitespace
(
cs
.
charAt
(
j
-
1
)))
{
while
(
j
>
0
)
{
prevChar
=
cs
.
charAt
(
j
-
1
);
if
(!
Character
.
isSpaceChar
(
prevChar
)
&&
prevChar
!=
Keyboard
.
CODE_TAB
)
break
;
j
--;
}
if
(
j
==
0
)
{
// There is only whitespace between the start of the text and the cursor. Both
if
(
j
<=
0
||
Character
.
isWhitespace
(
prevChar
))
{
// There are only spacing chars between the start of the paragraph and the cursor,
// defined as a isWhitespace() char that is neither a isSpaceChar() nor a tab. Both
// MODE_WORDS and MODE_SENTENCES should be active.
return
(
TextUtils
.
CAP_MODE_CHARACTERS
|
TextUtils
.
CAP_MODE_WORDS
|
TextUtils
.
CAP_MODE_SENTENCES
)
&
reqModes
;
...
...
This diff is collapsed.
Click to expand it.
tests/src/com/android/inputmethod/latin/StringUtilsTests.java
+
8
−
0
View file @
3f7fe829
...
...
@@ -140,6 +140,14 @@ public class StringUtilsTests extends AndroidTestCase {
allPathsForCaps
(
"Word"
,
c
|
w
,
l
,
true
);
allPathsForCaps
(
"Word."
,
c
|
w
|
s
,
l
,
true
);
// Tests after some whitespace
allPathsForCaps
(
"Word\n"
,
c
|
w
|
s
,
l
,
false
);
allPathsForCaps
(
"Word\n"
,
c
|
w
|
s
,
l
,
true
);
allPathsForCaps
(
"Word\n "
,
c
|
w
|
s
,
l
,
true
);
allPathsForCaps
(
"Word.\n"
,
c
|
w
|
s
,
l
,
false
);
allPathsForCaps
(
"Word.\n"
,
c
|
w
|
s
,
l
,
true
);
allPathsForCaps
(
"Word.\n "
,
c
|
w
|
s
,
l
,
true
);
l
=
Locale
.
FRENCH
;
allPathsForCaps
(
"\"Word.\" "
,
c
|
w
,
l
,
false
);
allPathsForCaps
(
"\"Word\". "
,
c
|
w
|
s
,
l
,
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