File tree Expand file tree Collapse file tree 2 files changed +12
-14
lines changed
packages/flutter/lib/src/services Expand file tree Collapse file tree 2 files changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -150,17 +150,16 @@ class ParagraphBoundary extends TextBoundary {
150
150
return 0 ;
151
151
}
152
152
153
- final List <int > codeUnits = _text.codeUnits;
154
153
int index = position;
155
154
156
- if (index > 1 && codeUnits[ index] == 0xA && codeUnits[ index - 1 ] == 0xD ) {
155
+ if (index > 1 && _text. codeUnitAt ( index) == 0x0A && _text. codeUnitAt ( index - 1 ) == 0x0D ) {
157
156
index -= 2 ;
158
- } else if (TextLayoutMetrics .isLineTerminator (codeUnits[ index] )) {
157
+ } else if (TextLayoutMetrics .isLineTerminator (_text. codeUnitAt ( index) )) {
159
158
index -= 1 ;
160
159
}
161
160
162
161
while (index > 0 ) {
163
- if (TextLayoutMetrics .isLineTerminator (codeUnits[ index] )) {
162
+ if (TextLayoutMetrics .isLineTerminator (_text. codeUnitAt ( index) )) {
164
163
return index + 1 ;
165
164
}
166
165
index -= 1 ;
@@ -183,19 +182,18 @@ class ParagraphBoundary extends TextBoundary {
183
182
return 0 ;
184
183
}
185
184
186
- final List <int > codeUnits = _text.codeUnits;
187
185
int index = position;
188
186
189
- while (! TextLayoutMetrics .isLineTerminator (codeUnits[ index] )) {
187
+ while (! TextLayoutMetrics .isLineTerminator (_text. codeUnitAt ( index) )) {
190
188
index += 1 ;
191
- if (index == codeUnits .length) {
189
+ if (index == _text .length) {
192
190
return index;
193
191
}
194
192
}
195
193
196
- return index < codeUnits .length - 1
197
- && codeUnits[ index] == 0xD
198
- && codeUnits[ index + 1 ] == 0xA
194
+ return index < _text .length - 1
195
+ && _text. codeUnitAt ( index) == 0x0D
196
+ && _text. codeUnitAt ( index + 1 ) == 0x0A
199
197
? index + 2
200
198
: index + 1 ;
201
199
}
Original file line number Diff line number Diff line change @@ -60,10 +60,10 @@ abstract class TextLayoutMetrics {
60
60
/// (https://www.unicode.org/standard/reports/tr13/tr13-5.html).
61
61
static bool isLineTerminator (int codeUnit) {
62
62
switch (codeUnit) {
63
- case 0xA : // line feed
64
- case 0xB : // vertical feed
65
- case 0xC : // form feed
66
- case 0xD : // carriage return
63
+ case 0x0A : // line feed
64
+ case 0x0B : // vertical feed
65
+ case 0x0C : // form feed
66
+ case 0x0D : // carriage return
67
67
case 0x85 : // new line
68
68
case 0x2028 : // line separator
69
69
case 0x2029 : // paragraph separator
You can’t perform that action at this time.
0 commit comments