@arhen/pi-senja 1.5.0 → 1.5.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/package.json +1 -1
- package/src/tool-groups.ts +5 -32
package/package.json
CHANGED
package/src/tool-groups.ts
CHANGED
|
@@ -448,40 +448,13 @@ export function createTranscriptView(
|
|
|
448
448
|
.replace(/\t/g, " ")
|
|
449
449
|
.split("\n");
|
|
450
450
|
const lang = summary(token.lang).split(" ")[0] || "code";
|
|
451
|
-
const
|
|
452
|
-
const
|
|
453
|
-
const
|
|
454
|
-
const
|
|
455
|
-
width - 2 * (pad + rim),
|
|
456
|
-
source.reduce((n, s) => Math.max(n, visibleWidth(s)), Math.max(18, visibleWidth(lang) + 12)),
|
|
457
|
-
);
|
|
458
|
-
const matte = (length: number) => {
|
|
459
|
-
const space = " ".repeat(length);
|
|
460
|
-
return theme.colors
|
|
461
|
-
? theme.style(space, { bg: theme.colors.customMessageLabel })
|
|
462
|
-
: theme.bg("customMessageBg", space);
|
|
463
|
-
};
|
|
464
|
-
const edge = matte(rim);
|
|
465
|
-
const line = (text: string) =>
|
|
466
|
-
edge +
|
|
467
|
-
theme.bg(
|
|
468
|
-
"toolSuccessBg",
|
|
469
|
-
" ".repeat(pad) + text + " ".repeat(Math.max(0, inner + pad - visibleWidth(text))),
|
|
470
|
-
) +
|
|
471
|
-
edge;
|
|
472
|
-
const cap = matte(inner + 2 * (pad + rim));
|
|
473
|
-
const dots = framed
|
|
474
|
-
? [theme.fg("error", "●"), theme.fg("warning", "●"), theme.fg("success", "●")].join(" ")
|
|
475
|
-
: "";
|
|
476
|
-
const label = truncateToWidth(lang, inner - visibleWidth(dots), "…");
|
|
477
|
-
const gap = Math.max(0, Math.floor((inner - visibleWidth(label)) / 2) - visibleWidth(dots));
|
|
478
|
-
const lines = [line(dots + " ".repeat(gap) + theme.fg("muted", label)), line("")];
|
|
479
|
-
if (framed) lines.unshift(cap);
|
|
451
|
+
const inset = width >= 8 ? " " : "";
|
|
452
|
+
const gutter = width >= 4 ? theme.fg("borderMuted", "▏") + " " : "";
|
|
453
|
+
const inner = width - inset.length - visibleWidth(gutter);
|
|
454
|
+
const lines = [inset + theme.fg("customMessageLabel", truncateToWidth(lang, width - inset.length, "…"))];
|
|
480
455
|
for (const logical of source) {
|
|
481
|
-
for (const row of wrapTextWithAnsi(logical, inner)) lines.push(
|
|
456
|
+
for (const row of wrapTextWithAnsi(logical, inner)) lines.push(inset + gutter + theme.fg("text", row));
|
|
482
457
|
}
|
|
483
|
-
lines.push(line(""));
|
|
484
|
-
if (framed) lines.push(cap);
|
|
485
458
|
if (rest[0] && rest[0] !== "space") lines.push("");
|
|
486
459
|
return lines;
|
|
487
460
|
},
|