Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
03141c2c
Commit
03141c2c
authored
May 12, 2016
by
Matt Perry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use engine's getWordBoundary method when user selects a word. (#3851)
parent
616d9e2e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
13 deletions
+7
-13
text_painter.dart
packages/flutter/lib/src/painting/text_painter.dart
+5
-0
editable_line.dart
packages/flutter/lib/src/rendering/editable_line.dart
+2
-13
No files found.
packages/flutter/lib/src/painting/text_painter.dart
View file @
03141c2c
...
...
@@ -229,4 +229,9 @@ class TextPainter {
return
_paragraph
.
getPositionForOffset
(
offset
);
}
TextRange
getWordBoundary
(
TextPosition
position
)
{
assert
(!
_needsLayout
);
List
<
int
>
indices
=
_paragraph
.
getWordBoundary
(
position
.
offset
);
return
new
TextRange
(
start:
indices
[
0
],
end:
indices
[
1
]);
}
}
packages/flutter/lib/src/rendering/editable_line.dart
View file @
03141c2c
...
...
@@ -232,19 +232,8 @@ class RenderEditableLine extends RenderBox {
}
TextSelection
_selectWordAtOffset
(
TextPosition
position
)
{
// TODO(mpcomplete): Placeholder. Need to ask the engine for this info to do
// it correctly.
String
str
=
text
.
toPlainText
();
int
start
=
position
.
offset
-
1
;
while
(
start
>=
0
&&
str
[
start
]
!=
' '
)
--
start
;
++
start
;
int
end
=
position
.
offset
;
while
(
end
<
str
.
length
&&
str
[
end
]
!=
' '
)
++
end
;
return
new
TextSelection
(
baseOffset:
start
,
extentOffset:
end
);
TextRange
word
=
_textPainter
.
getWordBoundary
(
position
);
return
new
TextSelection
(
baseOffset:
word
.
start
,
extentOffset:
word
.
end
);
}
Rect
_caretPrototype
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment