mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[web] Don't include end-of-line characters in line boundary (flutter/engine#39693)
This commit is contained in:
parent
66844e38d2
commit
f027ff2c95
@ -237,7 +237,7 @@ class CanvasParagraph implements ui.Paragraph {
|
||||
}
|
||||
|
||||
final ParagraphLine line = lines[i];
|
||||
return ui.TextRange(start: line.startIndex, end: line.endIndex);
|
||||
return ui.TextRange(start: line.startIndex, end: line.endIndex - line.trailingNewlines);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -700,7 +700,8 @@ Future<void> testMain() async {
|
||||
for (int i = 0; i < 11; i++) {
|
||||
expect(
|
||||
paragraph.getLineBoundary(ui.TextPosition(offset: i)),
|
||||
const ui.TextRange(start: 0, end: 11),
|
||||
// The "\n" is not included in the line boundary.
|
||||
const ui.TextRange(start: 0, end: 10),
|
||||
reason: 'failed at offset $i',
|
||||
);
|
||||
}
|
||||
@ -709,7 +710,8 @@ Future<void> testMain() async {
|
||||
for (int i = 11; i < 23; i++) {
|
||||
expect(
|
||||
paragraph.getLineBoundary(ui.TextPosition(offset: i)),
|
||||
const ui.TextRange(start: 11, end: 23),
|
||||
// The "\n" is not included in the line boundary.
|
||||
const ui.TextRange(start: 11, end: 22),
|
||||
reason: 'failed at offset $i',
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user