@heyhuynhgiabuu/pi-diff 0.1.4 → 0.1.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +9 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyhuynhgiabuu/pi-diff",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Shiki-powered terminal diff renderer for pi — syntax-highlighted, word-level diffs in split and unified views.",
5
5
  "author": "huynhgiabuu",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -225,6 +225,10 @@ function autoDeriveBgFromTheme(theme: any): void {
225
225
  // Empty filler and context — match the base
226
226
  BG_EMPTY = BG_BASE;
227
227
 
228
+ // Update RST to re-apply base bg after every reset — prevents black
229
+ // flashes between styled segments when toolSuccessBg is non-black
230
+ RST = `\x1b[0m${BG_BASE}`;
231
+
228
232
  // Rebuild derived constants
229
233
  DIVIDER = `${FG_RULE}│${RST}`;
230
234
  } catch {
@@ -370,7 +374,7 @@ const MAX_WRAP_ROWS_NARROW = 1; // <120 cols (truncate, no wrap)
370
374
  // ANSI
371
375
  // ---------------------------------------------------------------------------
372
376
 
373
- const RST = "\x1b[0m";
377
+ let RST = "\x1b[0m";
374
378
  const BOLD = "\x1b[1m";
375
379
  const DIM = "\x1b[2m";
376
380
 
@@ -433,7 +437,10 @@ function resolveDiffColors(theme?: any): DiffColors {
433
437
  try {
434
438
  const bgAnsi = theme.getBgAnsi("toolSuccessBg");
435
439
  const parsed = parseAnsiRgb(bgAnsi);
436
- if (parsed) BG_BASE = bgAnsi;
440
+ if (parsed) {
441
+ BG_BASE = bgAnsi;
442
+ RST = `\x1b[0m${BG_BASE}`;
443
+ }
437
444
  } catch { /* ignore */ }
438
445
  }
439
446