@duanz/pi-d-live 1.1.5 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +6 -1
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -780,7 +780,12 @@ function rewrite(s: Sess, sid: string, text: string) {
|
|
|
780
780
|
if (lines.length) {
|
|
781
781
|
// 一条播报只放一句能塞进一行的:太长的按标点切成两句,免得手机上前端被迫缩字换行
|
|
782
782
|
const capped: string[] = [];
|
|
783
|
-
for (const line of lines)
|
|
783
|
+
for (const line of lines)
|
|
784
|
+
for (const piece of splitLong(line)) {
|
|
785
|
+
// 切句切出来的碎渣(比如单独一个 emoji 加句号)并回上一句,别让它自己占一行
|
|
786
|
+
if (piece.length < 6 && capped.length) capped[capped.length - 1] += piece;
|
|
787
|
+
else capped.push(piece);
|
|
788
|
+
}
|
|
784
789
|
emit({ kind: "lines", sid, lines: capped });
|
|
785
790
|
s.history = s.history.concat(capped).slice(-8);
|
|
786
791
|
}
|