File tree Expand file tree Collapse file tree
packages/flutter/lib/src/services Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -150,17 +150,16 @@ class ParagraphBoundary extends TextBoundary {
150150 return 0 ;
151151 }
152152
153- final List <int > codeUnits = _text.codeUnits;
154153 int index = position;
155154
156- if (index > 1 && codeUnits[ index] == 0xA && codeUnits[ index - 1 ] == 0xD ) {
155+ if (index > 1 && _text. codeUnitAt ( index) == 0x0A && _text. codeUnitAt ( index - 1 ) == 0x0D ) {
157156 index -= 2 ;
158- } else if (TextLayoutMetrics .isLineTerminator (codeUnits[ index] )) {
157+ } else if (TextLayoutMetrics .isLineTerminator (_text. codeUnitAt ( index) )) {
159158 index -= 1 ;
160159 }
161160
162161 while (index > 0 ) {
163- if (TextLayoutMetrics .isLineTerminator (codeUnits[ index] )) {
162+ if (TextLayoutMetrics .isLineTerminator (_text. codeUnitAt ( index) )) {
164163 return index + 1 ;
165164 }
166165 index -= 1 ;
@@ -183,19 +182,18 @@ class ParagraphBoundary extends TextBoundary {
183182 return 0 ;
184183 }
185184
186- final List <int > codeUnits = _text.codeUnits;
187185 int index = position;
188186
189- while (! TextLayoutMetrics .isLineTerminator (codeUnits[ index] )) {
187+ while (! TextLayoutMetrics .isLineTerminator (_text. codeUnitAt ( index) )) {
190188 index += 1 ;
191- if (index == codeUnits .length) {
189+ if (index == _text .length) {
192190 return index;
193191 }
194192 }
195193
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
199197 ? index + 2
200198 : index + 1 ;
201199 }
Original file line number Diff line number Diff line change @@ -60,10 +60,10 @@ abstract class TextLayoutMetrics {
6060 /// (https://www.unicode.org/standard/reports/tr13/tr13-5.html).
6161 static bool isLineTerminator (int codeUnit) {
6262 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
6767 case 0x85 : // new line
6868 case 0x2028 : // line separator
6969 case 0x2029 : // paragraph separator
You can’t perform that action at this time.
0 commit comments