Fix calculation of downstream caret location at the end of a string (#13426)
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user