Commit 4341ed4
authored
Fix the breaking of multi-code-unit characters in obscure mode (#123366)
This PR changes the character boundary behavior of obscured fields to be based on code points instead of code units.
So it used to be possible to traverse and delete obscured text inside of code points (and breaking a code point like that would cause a crash):

But now moving the cursor and deleting is based on code points:

### Native behavior
Native iOS deletes part of the emoji, native Mac deletes the whole emoji. See flutter/flutter#122381 (comment). So it's unclear what the desired behavior should actually be.
### Resources
Fixes flutter/flutter#122381
I thought this might not fix the case where a broken emoji is directly pasted into the field, but it seems to work by trying this: �������
CC @LongCatIsLooong1 parent ffbeb72 commit 4341ed4
File tree
5 files changed
+509
-28
lines changed- packages/flutter
- lib/src
- painting
- services
- widgets
- test/widgets
5 files changed
+509
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
| 173 | + | |
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
| 177 | + | |
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| |||
991 | 991 | | |
992 | 992 | | |
993 | 993 | | |
994 | | - | |
995 | | - | |
996 | | - | |
997 | | - | |
998 | | - | |
999 | | - | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
1000 | 1009 | | |
1001 | 1010 | | |
1002 | 1011 | | |
1003 | | - | |
1004 | | - | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
1005 | 1022 | | |
1006 | 1023 | | |
1007 | 1024 | | |
| |||
1021 | 1038 | | |
1022 | 1039 | | |
1023 | 1040 | | |
1024 | | - | |
| 1041 | + | |
1025 | 1042 | | |
1026 | 1043 | | |
1027 | 1044 | | |
| |||
1032 | 1049 | | |
1033 | 1050 | | |
1034 | 1051 | | |
1035 | | - | |
| 1052 | + | |
1036 | 1053 | | |
1037 | 1054 | | |
1038 | 1055 | | |
| |||
1052 | 1069 | | |
1053 | 1070 | | |
1054 | 1071 | | |
1055 | | - | |
| 1072 | + | |
1056 | 1073 | | |
1057 | 1074 | | |
1058 | 1075 | | |
| |||
1103 | 1120 | | |
1104 | 1121 | | |
1105 | 1122 | | |
1106 | | - | |
| 1123 | + | |
1107 | 1124 | | |
1108 | 1125 | | |
1109 | 1126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
| |||
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
42 | | - | |
43 | | - | |
| 45 | + | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
46 | 52 | | |
47 | 53 | | |
48 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4246 | 4246 | | |
4247 | 4247 | | |
4248 | 4248 | | |
4249 | | - | |
| 4249 | + | |
4250 | 4250 | | |
4251 | 4251 | | |
4252 | 4252 | | |
| |||
5076 | 5076 | | |
5077 | 5077 | | |
5078 | 5078 | | |
5079 | | - | |
| 5079 | + | |
5080 | 5080 | | |
5081 | | - | |
5082 | | - | |
5083 | | - | |
5084 | | - | |
5085 | | - | |
5086 | | - | |
| 5081 | + | |
| 5082 | + | |
| 5083 | + | |
| 5084 | + | |
| 5085 | + | |
| 5086 | + | |
| 5087 | + | |
| 5088 | + | |
| 5089 | + | |
| 5090 | + | |
| 5091 | + | |
| 5092 | + | |
| 5093 | + | |
| 5094 | + | |
| 5095 | + | |
| 5096 | + | |
| 5097 | + | |
| 5098 | + | |
| 5099 | + | |
5087 | 5100 | | |
5088 | 5101 | | |
5089 | 5102 | | |
| 5103 | + | |
| 5104 | + | |
| 5105 | + | |
| 5106 | + | |
| 5107 | + | |
| 5108 | + | |
| 5109 | + | |
5090 | 5110 | | |
5091 | | - | |
| 5111 | + | |
| 5112 | + | |
| 5113 | + | |
| 5114 | + | |
| 5115 | + | |
| 5116 | + | |
| 5117 | + | |
| 5118 | + | |
| 5119 | + | |
| 5120 | + | |
| 5121 | + | |
| 5122 | + | |
| 5123 | + | |
| 5124 | + | |
| 5125 | + | |
| 5126 | + | |
| 5127 | + | |
| 5128 | + | |
| 5129 | + | |
5092 | 5130 | | |
5093 | | - | |
| 5131 | + | |
| 5132 | + | |
| 5133 | + | |
| 5134 | + | |
| 5135 | + | |
| 5136 | + | |
| 5137 | + | |
| 5138 | + | |
| 5139 | + | |
| 5140 | + | |
| 5141 | + | |
| 5142 | + | |
| 5143 | + | |
| 5144 | + | |
| 5145 | + | |
| 5146 | + | |
| 5147 | + | |
| 5148 | + | |
5094 | 5149 | | |
5095 | 5150 | | |
5096 | 5151 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
444 | 444 | | |
445 | 445 | | |
446 | 446 | | |
| 447 | + | |
447 | 448 | | |
448 | 449 | | |
449 | | - | |
| 450 | + | |
450 | 451 | | |
451 | 452 | | |
452 | 453 | | |
453 | 454 | | |
454 | | - | |
| 455 | + | |
455 | 456 | | |
456 | 457 | | |
457 | 458 | | |
| |||
0 commit comments