arbiter-ai 1.4.0 → 1.4.1
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/dist/tui/questLog.js +20 -12
- package/package.json +1 -1
package/dist/tui/questLog.js
CHANGED
|
@@ -60,24 +60,32 @@ export function createQuestLog(deps) {
|
|
|
60
60
|
return text.slice(0, maxLen - 1) + '…';
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
|
-
* Wrap text to multiple lines
|
|
63
|
+
* Wrap text to multiple lines, respecting existing newlines
|
|
64
64
|
*/
|
|
65
65
|
function wrapText(text, width) {
|
|
66
|
-
const words = text.split(' ');
|
|
67
66
|
const lines = [];
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
// Split on newlines first, then wrap each paragraph
|
|
68
|
+
const paragraphs = text.split(/\r?\n/);
|
|
69
|
+
for (const paragraph of paragraphs) {
|
|
70
|
+
if (paragraph.trim() === '') {
|
|
71
|
+
lines.push('');
|
|
72
|
+
continue;
|
|
72
73
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
currentLine
|
|
74
|
+
const words = paragraph.split(' ');
|
|
75
|
+
let currentLine = '';
|
|
76
|
+
for (const word of words) {
|
|
77
|
+
if (currentLine.length + word.length + 1 <= width) {
|
|
78
|
+
currentLine += (currentLine ? ' ' : '') + word;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
if (currentLine)
|
|
82
|
+
lines.push(currentLine);
|
|
83
|
+
currentLine = word;
|
|
84
|
+
}
|
|
77
85
|
}
|
|
86
|
+
if (currentLine)
|
|
87
|
+
lines.push(currentLine);
|
|
78
88
|
}
|
|
79
|
-
if (currentLine)
|
|
80
|
-
lines.push(currentLine);
|
|
81
89
|
return lines;
|
|
82
90
|
}
|
|
83
91
|
/**
|
package/package.json
CHANGED