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

This commit is contained in:
Jason Simmons
2017-12-07 15:34:42 -08:00
committed by GitHub
parent 38c82ea88f
commit 3979dafaed
2 changed files with 2 additions and 3 deletions

View File

@@ -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;

View File

@@ -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()