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
6827d092
Unverified
Commit
6827d092
authored
Oct 26, 2018
by
Gary Qian
Committed by
GitHub
Oct 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Same cursor offset within lines for all TextAffinities to prevent cursor shifting/moving. (#23485)
parent
340c158f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
2 deletions
+9
-2
goldens.version
bin/internal/goldens.version
+1
-1
text_painter.dart
packages/flutter/lib/src/painting/text_painter.dart
+1
-1
text_field_test.dart
packages/flutter/test/material/text_field_test.dart
+7
-0
No files found.
bin/internal/goldens.version
View file @
6827d092
afef1dc571f94a41751917d3946defba782335f7
055a75c5a63bf2b2c5142b38b88829593908fd10
packages/flutter/lib/src/painting/text_painter.dart
View file @
6827d092
...
...
@@ -421,7 +421,7 @@ class TextPainter {
return
null
;
final
TextBox
box
=
boxes
[
0
];
final
double
caretEnd
=
box
.
end
;
final
double
dx
=
box
.
direction
==
TextDirection
.
rtl
?
caretEnd
:
caretEnd
-
caretPrototype
.
width
;
final
double
dx
=
box
.
direction
==
TextDirection
.
rtl
?
caretEnd
-
caretPrototype
.
width
:
caretEnd
;
return
Offset
(
dx
,
box
.
top
);
}
...
...
packages/flutter/test/material/text_field_test.dart
View file @
6827d092
...
...
@@ -741,6 +741,11 @@ void main() {
final
Offset
firstPos
=
textOffsetToPosition
(
tester
,
testValue
.
indexOf
(
'First'
));
final
Offset
secondPos
=
textOffsetToPosition
(
tester
,
testValue
.
indexOf
(
'Second'
));
final
Offset
thirdPos
=
textOffsetToPosition
(
tester
,
testValue
.
indexOf
(
'Third'
));
final
Offset
middleStringPos
=
textOffsetToPosition
(
tester
,
testValue
.
indexOf
(
'irst'
));
expect
(
firstPos
.
dx
,
0
);
expect
(
secondPos
.
dx
,
0
);
expect
(
thirdPos
.
dx
,
0
);
expect
(
middleStringPos
.
dx
,
34
);
expect
(
firstPos
.
dx
,
secondPos
.
dx
);
expect
(
firstPos
.
dx
,
thirdPos
.
dx
);
expect
(
firstPos
.
dy
,
lessThan
(
secondPos
.
dy
));
...
...
@@ -823,6 +828,8 @@ void main() {
// Check that the last line of text is not displayed.
final
Offset
firstPos
=
textOffsetToPosition
(
tester
,
kMoreThanFourLines
.
indexOf
(
'First'
));
final
Offset
fourthPos
=
textOffsetToPosition
(
tester
,
kMoreThanFourLines
.
indexOf
(
'Fourth'
));
expect
(
firstPos
.
dx
,
0
);
expect
(
fourthPos
.
dx
,
0
);
expect
(
firstPos
.
dx
,
fourthPos
.
dx
);
expect
(
firstPos
.
dy
,
lessThan
(
fourthPos
.
dy
));
expect
(
inputBox
.
hitTest
(
HitTestResult
(),
position:
inputBox
.
globalToLocal
(
firstPos
)),
isTrue
);
...
...
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