@standardagents/code 0.6.2 → 0.6.3
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/index.js +24 -19
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3185,27 +3185,32 @@ var Tui = class _Tui {
|
|
|
3185
3185
|
const cols2 = Math.max(20, process.stdout.columns || 80);
|
|
3186
3186
|
const bg = "\x1B[48;5;238m";
|
|
3187
3187
|
const limit = Math.max(8, cols2 - 6);
|
|
3188
|
-
const
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
cur
|
|
3188
|
+
const wrapLine = (logical) => {
|
|
3189
|
+
const words = logical.replace(/[^\S\n]+/g, " ").trim().split(" ").filter(Boolean);
|
|
3190
|
+
if (!words.length) return [""];
|
|
3191
|
+
const out = [];
|
|
3192
|
+
let cur = "";
|
|
3193
|
+
for (let w of words) {
|
|
3194
|
+
while (w.length > limit) {
|
|
3195
|
+
if (cur) {
|
|
3196
|
+
out.push(cur);
|
|
3197
|
+
cur = "";
|
|
3198
|
+
}
|
|
3199
|
+
out.push(w.slice(0, limit));
|
|
3200
|
+
w = w.slice(limit);
|
|
3201
|
+
}
|
|
3202
|
+
if (!cur) cur = w;
|
|
3203
|
+
else if (cur.length + 1 + w.length <= limit) cur += " " + w;
|
|
3204
|
+
else {
|
|
3205
|
+
out.push(cur);
|
|
3206
|
+
cur = w;
|
|
3196
3207
|
}
|
|
3197
|
-
lines.push(w.slice(0, limit));
|
|
3198
|
-
w = w.slice(limit);
|
|
3199
|
-
}
|
|
3200
|
-
if (!cur) cur = w;
|
|
3201
|
-
else if (cur.length + 1 + w.length <= limit) cur += " " + w;
|
|
3202
|
-
else {
|
|
3203
|
-
lines.push(cur);
|
|
3204
|
-
cur = w;
|
|
3205
3208
|
}
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
+
if (cur || !out.length) out.push(cur);
|
|
3210
|
+
return out;
|
|
3211
|
+
};
|
|
3212
|
+
const lines = text.replace(/\r\n?/g, "\n").split("\n").flatMap(wrapLine);
|
|
3213
|
+
const innerW = 2 + Math.max(1, ...lines.map((l) => l.length));
|
|
3209
3214
|
this.print("");
|
|
3210
3215
|
lines.forEach((line, i) => {
|
|
3211
3216
|
const rowText = (i === 0 ? "\u276F " : " ") + line;
|