zames_pro 2.21.1 → 2.22.0
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/input.js +13 -4
- package/package.json +1 -1
package/dist/input.js
CHANGED
|
@@ -221,7 +221,9 @@ export function formatTokenStatus(tokens, limit = CONTEXT_LIMIT) {
|
|
|
221
221
|
}
|
|
222
222
|
const pct = Math.max(0, (n / limit) * 100);
|
|
223
223
|
const pctStr = pct >= 10 ? String(Math.round(pct)) : pct.toFixed(1);
|
|
224
|
-
|
|
224
|
+
// "ctx" marks this as the USED context size, so the operator does not have
|
|
225
|
+
// to guess what "302k · 30%" means.
|
|
226
|
+
return 'ctx ' + compact + ' · ' + pctStr + '%';
|
|
225
227
|
}
|
|
226
228
|
export class LineEditor {
|
|
227
229
|
promptStr;
|
|
@@ -542,13 +544,20 @@ export class LineEditor {
|
|
|
542
544
|
const ctxText = this._contextText();
|
|
543
545
|
let statusOut = '';
|
|
544
546
|
let top = 0;
|
|
547
|
+
// Never fill a row to the FULL terminal width: on terminals with
|
|
548
|
+
// autowrap (Tabby, iTerm, Windows Terminal) a row that reaches the last
|
|
549
|
+
// column wraps the cursor to the next line, so the following erase moves
|
|
550
|
+
// to the wrong row and the status line STACKS on screen. Keep one column
|
|
551
|
+
// free (effective width = cols - 1) for the right-aligned context and for
|
|
552
|
+
// the padded status row.
|
|
553
|
+
const usable = Math.max(1, cols - 1);
|
|
545
554
|
if (this.statusText) {
|
|
546
555
|
if (ctxText) {
|
|
547
556
|
// Right-align the context on the SAME row as the status. When the
|
|
548
557
|
// status is too long to leave room, do NOT cram them together (that
|
|
549
558
|
// pushed the trailing `%` past the right edge and it got truncated):
|
|
550
559
|
// put the context on its own line instead.
|
|
551
|
-
const space =
|
|
560
|
+
const space = usable - visLen(this.statusText) - visLen(ctxText);
|
|
552
561
|
if (space >= 2) {
|
|
553
562
|
const row = this.statusText + ' '.repeat(space) + ctxText;
|
|
554
563
|
statusOut = row + NL;
|
|
@@ -557,7 +566,7 @@ export class LineEditor {
|
|
|
557
566
|
else {
|
|
558
567
|
statusOut = this.statusText + NL;
|
|
559
568
|
top = visRows(this.statusText, cols);
|
|
560
|
-
const ctxRow = ' '.repeat(Math.max(0,
|
|
569
|
+
const ctxRow = ' '.repeat(Math.max(0, usable - visLen(ctxText))) + ctxText;
|
|
561
570
|
statusOut += ctxRow + NL;
|
|
562
571
|
top += visRows(ctxRow, cols);
|
|
563
572
|
}
|
|
@@ -572,7 +581,7 @@ export class LineEditor {
|
|
|
572
581
|
else if (ctxText) {
|
|
573
582
|
// Idle: no spinner, but the context still belongs on its own line just
|
|
574
583
|
// above the input, right-aligned.
|
|
575
|
-
const ctxRow = ' '.repeat(Math.max(0,
|
|
584
|
+
const ctxRow = ' '.repeat(Math.max(0, usable - visLen(ctxText))) + ctxText;
|
|
576
585
|
statusOut = ctxRow + NL;
|
|
577
586
|
top = visRows(ctxRow, cols);
|
|
578
587
|
}
|