Commit f0ec806
Preserve mid-text spaces in legacy/MiniMessage round-trip
The legacy locale hack of stripping one space after a color code (so
auto-translators wouldn't glue "&c" onto "Hello") was being applied
unconditionally, including after &r and after mid-text color transitions.
This ate inter-segment spaces in round-tripped MiniMessage — e.g.
"<gray>Page </gray><yellow>[page]</yellow><gray> of </gray>..." rendered
as "Page 1of 4" because componentToLegacy emits "§7Page §e1§7 of §e4"
and legacyToMiniMessage then stripped the space after the mid-text §7.
Restrict the strip to boundary positions only: start of string, after
whitespace, or immediately after another legacy code. Also skip §r in
all cases (it's a format terminator). Applied in legacyToMiniMessage,
replaceLegacyCodesInline, and stripSpaceAfterColorCodes.
BentoBoxWorld/AOneBlock#495
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 40d611d commit f0ec806
2 files changed
Lines changed: 138 additions & 7 deletions
File tree
- src
- main/java/world/bentobox/bentobox/util
- test/java/world/bentobox/bentobox/util
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
704 | 704 | | |
705 | 705 | | |
706 | 706 | | |
707 | | - | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
708 | 715 | | |
709 | 716 | | |
710 | 717 | | |
| |||
1059 | 1066 | | |
1060 | 1067 | | |
1061 | 1068 | | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
1062 | 1072 | | |
1063 | 1073 | | |
1064 | 1074 | | |
1065 | 1075 | | |
1066 | 1076 | | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
1067 | 1085 | | |
1068 | | - | |
1069 | | - | |
| 1086 | + | |
| 1087 | + | |
1070 | 1088 | | |
1071 | 1089 | | |
| 1090 | + | |
1072 | 1091 | | |
1073 | 1092 | | |
1074 | 1093 | | |
| |||
1116 | 1135 | | |
1117 | 1136 | | |
1118 | 1137 | | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
1119 | 1142 | | |
1120 | 1143 | | |
1121 | 1144 | | |
| |||
1140 | 1163 | | |
1141 | 1164 | | |
1142 | 1165 | | |
1143 | | - | |
1144 | | - | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
1145 | 1169 | | |
1146 | 1170 | | |
| 1171 | + | |
1147 | 1172 | | |
1148 | 1173 | | |
1149 | 1174 | | |
1150 | 1175 | | |
| 1176 | + | |
1151 | 1177 | | |
1152 | 1178 | | |
1153 | 1179 | | |
| |||
1200 | 1226 | | |
1201 | 1227 | | |
1202 | 1228 | | |
| 1229 | + | |
| 1230 | + | |
1203 | 1231 | | |
1204 | 1232 | | |
1205 | 1233 | | |
1206 | 1234 | | |
1207 | 1235 | | |
| 1236 | + | |
| 1237 | + | |
1208 | 1238 | | |
1209 | 1239 | | |
1210 | | - | |
1211 | | - | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
1212 | 1243 | | |
1213 | 1244 | | |
| 1245 | + | |
1214 | 1246 | | |
1215 | 1247 | | |
1216 | 1248 | | |
1217 | 1249 | | |
| 1250 | + | |
1218 | 1251 | | |
1219 | 1252 | | |
1220 | 1253 | | |
| |||
Lines changed: 98 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
190 | 288 | | |
0 commit comments