Compare commits

...

4 Commits

Author SHA1 Message Date
AncTe
fead02b9f3
Merge 91c7ee455c into 820dc5bf4c 2025-11-01 10:15:34 +00:00
91c7ee455c fix: TextContentParser 返回结果错误 2025-11-01 18:15:23 +08:00
1ee3c44d26 fix: TextContentParser 特殊情况 2025-11-01 18:06:46 +08:00
ee5c6a687e fix: TextContent \\n 解析问题 2025-11-01 16:06:13 +08:00

View File

@ -817,7 +817,7 @@ export class TextContentParser {
return pointer; return pointer;
} }
const time = parseInt(param); const time = parseInt(param);
this.addWaitRenderable(end, time); this.addWaitRenderable(end + 1, time);
return end; return end;
} }
@ -830,19 +830,19 @@ export class TextContentParser {
} }
if (/^\d+$/.test(param)) { if (/^\d+$/.test(param)) {
const num = Number(param); const num = Number(param);
this.addIconRenderable(end, num as AllNumbers); this.addIconRenderable(end + 1, num as AllNumbers);
} else { } else {
if (/^X\d+$/.test(param)) { if (/^X\d+$/.test(param)) {
// 额外素材 // 额外素材
const num = Number(param.slice(1)); const num = Number(param.slice(1));
this.addIconRenderable(end, num as AllNumbers); this.addIconRenderable(end + 1, num as AllNumbers);
} else { } else {
const num = texture.idNumberMap[param as AllIds]; const num = texture.idNumberMap[param as AllIds];
if (num === void 0) { if (num === void 0) {
logger.warn(59, param); logger.warn(59, param);
return end; return end;
} }
this.addIconRenderable(end, num); this.addIconRenderable(end + 1, num);
} }
} }
return end; return end;
@ -960,6 +960,7 @@ export class TextContentParser {
break; break;
case 'n': case 'n':
// 在这里预先将换行处理为多个 node会比在分行时再处理更方便 // 在这里预先将换行处理为多个 node会比在分行时再处理更方便
pointer++;
this.addTextNode(pointer + 1, true); this.addTextNode(pointer + 1, true);
break; break;
} }
@ -985,7 +986,9 @@ export class TextContentParser {
this.resolved += char; this.resolved += char;
} }
if (this.nodePointer < text.length) {
this.addTextNode(text.length, false); this.addTextNode(text.length, false);
}
return this.splitLines(width); return this.splitLines(width);
} }