Unverified Commit 3979dafa authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Fix calculation of downstream caret location at the end of a string (#13426)

parent 38c82ea8
......@@ -416,7 +416,7 @@ class TextPainter {
}
Offset _getOffsetFromDownstream(int offset, Rect caretPrototype) {
final int nextCodeUnit = _text.codeUnitAt(offset + 1);
final int nextCodeUnit = _text.codeUnitAt(offset);
if (nextCodeUnit == null)
return null;
final int nextRuneOffset = _isUtf16Surrogate(nextCodeUnit) ? offset + 2 : offset + 1;
......
......@@ -287,7 +287,6 @@ void main() {
expect( // between A and Alef, before the Alef
painter.getOffsetForCaret(const TextPosition(offset: 1, affinity: TextAffinity.downstream), Rect.zero),
const Offset(10.0, 10.0),
skip: skipExpectsWithKnownBugs, // this ends up on the wrong line currently - this is a major bug
);
expect( // after the Alef
......@@ -318,7 +317,7 @@ void main() {
const TextBox.fromLTRBD(0.0, 10.0, 10.0, 20.0, TextDirection.rtl), // Alef
],
);
}, skip: skipTestsWithKnownBugs);
});
test('TextPainter - line wrap mid-word', () {
final TextPainter painter = new TextPainter()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment