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
bccacfed
Unverified
Commit
bccacfed
authored
Apr 18, 2021
by
Ludwik Trammer
Committed by
GitHub
Apr 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix problem with right-clicking on a right-to-left selection (#80186)
parent
0f8148ec
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
3 deletions
+47
-3
AUTHORS
AUTHORS
+1
-0
text_selection.dart
packages/flutter/lib/src/widgets/text_selection.dart
+2
-2
text_selection_test.dart
packages/flutter/test/widgets/text_selection_test.dart
+44
-1
No files found.
AUTHORS
View file @
bccacfed
...
@@ -76,3 +76,4 @@ Pedro Massango <pedromassango.developer@gmail.com>
...
@@ -76,3 +76,4 @@ Pedro Massango <pedromassango.developer@gmail.com>
Hidenori Matsubayashi <Hidenori.Matsubayashi@sony.com>
Hidenori Matsubayashi <Hidenori.Matsubayashi@sony.com>
Perqin Xie <perqinxie@gmail.com>
Perqin Xie <perqinxie@gmail.com>
Seongyun Kim <helloworld@cau.ac.kr>
Seongyun Kim <helloworld@cau.ac.kr>
Ludwik Trammer <ludwik@gmail.com>
packages/flutter/lib/src/widgets/text_selection.dart
View file @
bccacfed
...
@@ -963,8 +963,8 @@ class TextSelectionGestureDetectorBuilder {
...
@@ -963,8 +963,8 @@ class TextSelectionGestureDetectorBuilder {
renderEditable
.
lastSecondaryTapDownPosition
!,
renderEditable
.
lastSecondaryTapDownPosition
!,
);
);
return
renderEditable
.
selection
!.
base
.
offse
t
<=
textPosition
.
offset
return
renderEditable
.
selection
!.
star
t
<=
textPosition
.
offset
&&
renderEditable
.
selection
!.
e
xtent
.
offset
>=
textPosition
.
offset
;
&&
renderEditable
.
selection
!.
e
nd
>=
textPosition
.
offset
;
}
}
/// Whether to show the selection toolbar.
/// Whether to show the selection toolbar.
...
...
packages/flutter/test/widgets/text_selection_test.dart
View file @
bccacfed
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/gestures.dart'
show
PointerDeviceKind
;
import
'package:flutter/gestures.dart'
show
PointerDeviceKind
,
kSecondaryButton
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter/services.dart'
;
...
@@ -487,6 +487,49 @@ void main() {
...
@@ -487,6 +487,49 @@ void main() {
expect
(
renderEditable
.
selectPositionAtCalled
,
isTrue
);
expect
(
renderEditable
.
selectPositionAtCalled
,
isTrue
);
});
});
testWidgets
(
'TextSelectionGestureDetectorBuilder right click'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/80119
await
pumpTextSelectionGestureDetectorBuilder
(
tester
);
final
FakeRenderEditable
renderEditable
=
tester
.
renderObject
(
find
.
byType
(
FakeEditable
));
renderEditable
.
text
=
const
TextSpan
(
text:
'one two three four five six seven'
);
await
tester
.
pump
();
final
TestGesture
gesture
=
await
tester
.
createGesture
(
pointer:
0
,
kind:
PointerDeviceKind
.
mouse
,
buttons:
kSecondaryButton
,
);
addTearDown
(
gesture
.
removePointer
);
// Get the location of the 10th character
final
Offset
charLocation
=
renderEditable
.
getLocalRectForCaret
(
const
TextPosition
(
offset:
10
)).
center
;
final
Offset
globalCharLocation
=
charLocation
+
tester
.
getTopLeft
(
find
.
byType
(
FakeEditable
));
// Right clicking on a word should select it
await
gesture
.
down
(
globalCharLocation
);
await
gesture
.
up
();
await
tester
.
pump
();
expect
(
renderEditable
.
selectWordCalled
,
isTrue
);
// Right clicking on a word within a selection shouldn't change the selection
renderEditable
.
selectWordCalled
=
false
;
renderEditable
.
selection
=
const
TextSelection
(
baseOffset:
3
,
extentOffset:
20
);
await
gesture
.
down
(
globalCharLocation
);
await
gesture
.
up
();
await
tester
.
pump
();
expect
(
renderEditable
.
selectWordCalled
,
isFalse
);
// Right clicking on a word within a reverse (right-to-left) selection shouldn't change the selection
renderEditable
.
selectWordCalled
=
false
;
renderEditable
.
selection
=
const
TextSelection
(
baseOffset:
20
,
extentOffset:
3
);
await
gesture
.
down
(
globalCharLocation
);
await
gesture
.
up
();
await
tester
.
pump
();
expect
(
renderEditable
.
selectWordCalled
,
isFalse
);
});
testWidgets
(
'test TextSelectionGestureDetectorBuilder tap'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'test TextSelectionGestureDetectorBuilder tap'
,
(
WidgetTester
tester
)
async
{
await
pumpTextSelectionGestureDetectorBuilder
(
tester
);
await
pumpTextSelectionGestureDetectorBuilder
(
tester
);
final
TestGesture
gesture
=
await
tester
.
startGesture
(
final
TestGesture
gesture
=
await
tester
.
startGesture
(
...
...
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