claude-token-saver 2.8.1 → 2.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-token-saver",
3
- "version": "2.8.1",
3
+ "version": "2.8.3",
4
4
  "description": "Save tokens on Claude Code — spike diagnosis, 1M-context detection, TTL countdown, statusline. (formerly claude-cache-monitor)",
5
5
  "type": "module",
6
6
  "bin": {
@@ -394,5 +394,20 @@ export function formatReport(data, { color = true, verbose = false, timer = true
394
394
  // timeframe footer.
395
395
  if (want('saved')) segs.push(saveSeg);
396
396
  if (want('period')) segs.push(periodSeg);
397
- return segs.join(' · ');
397
+ // Trailing erase-to-end-of-line so any leftover characters from a previous
398
+ // (longer) statusline render don't bleed into ours. Some terminals + the
399
+ // Claude Code statusline integration don't fully clear the line on rewrite,
400
+ // which surfaced as "Cache expires 4:574" or "Cache expires 43550" — old
401
+ // digits from a prior frame leaking past the new shorter timer text.
402
+ // \x1b[K is the standard "erase from cursor to EOL" CSI; safe on any
403
+ // ANSI-compatible terminal and a no-op when stdout isn't a TTY.
404
+ // Defensive overwrite — terminals that miscount emoji width (JetBrains JediTerm
405
+ // is the known case, but others surface periodically) leave the cursor at the
406
+ // wrong column, which makes trailing `\x1b[K` erase the wrong region and
407
+ // leftover bytes from the previous frame fuse with the new one ("4:54" + "8"
408
+ // → "4:548"). Appending a run of spaces overwrites those leftover bytes
409
+ // positionally without any clear-then-redraw step (so no flicker), and is
410
+ // invisible on terminals that already redraw cleanly. `\x1b[K` still mops up
411
+ // anything beyond the padding.
412
+ return segs.join(' · ') + ' '.repeat(40) + '\x1b[K';
398
413
  }