pi-fabric 0.60.0 → 0.60.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.
@@ -3159,7 +3159,7 @@ var createSimpleDiff = (before, after) => {
3159
3159
  let changed = false;
3160
3160
  let firstChangedLine = 1;
3161
3161
  const context = 3;
3162
- const contextLines = (lines, oldStart, newStart) => lines.map((line, offset) => ` ${newStart + offset} ${line}`);
3162
+ const contextLines = (lines, oldStart) => lines.map((line, offset) => ` ${oldStart + offset} ${line}`);
3163
3163
  for (let index = 0; index < changes.length; index++) {
3164
3164
  const change = changes[index];
3165
3165
  const lines = change.value.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n");
@@ -3168,14 +3168,14 @@ var createSimpleDiff = (before, after) => {
3168
3168
  const later = hasChangeAfter[index] ?? false;
3169
3169
  if (!changed && later) {
3170
3170
  const start = Math.max(0, lines.length - context);
3171
- out.push(...contextLines(lines.slice(start), oldLine + start, newLine + start));
3171
+ out.push(...contextLines(lines.slice(start), oldLine + start));
3172
3172
  } else if (changed) {
3173
3173
  if (later && lines.length > context * 2) {
3174
- out.push(...contextLines(lines.slice(0, context), oldLine, newLine));
3174
+ out.push(...contextLines(lines.slice(0, context), oldLine));
3175
3175
  out.push("...");
3176
- out.push(...contextLines(lines.slice(-context), oldLine + lines.length - context, newLine + lines.length - context));
3176
+ out.push(...contextLines(lines.slice(-context), oldLine + lines.length - context));
3177
3177
  } else {
3178
- out.push(...contextLines(lines.slice(0, later ? lines.length : context), oldLine, newLine));
3178
+ out.push(...contextLines(lines.slice(0, later ? lines.length : context), oldLine));
3179
3179
  }
3180
3180
  }
3181
3181
  oldLine += lines.length;
@@ -3199,6 +3199,25 @@ var hashSourceText = (value) => {
3199
3199
  return hash;
3200
3200
  };
3201
3201
  var DIFF_REMOVED_CONTEXT_LINES = 512;
3202
+ var postEditFileRows = (parsed) => {
3203
+ const rows = [];
3204
+ let lineDelta = 0;
3205
+ for (let index = 0; index < parsed.length; index++) {
3206
+ const line = parsed[index];
3207
+ if (!line) continue;
3208
+ const lineNumber = Number.parseInt(line.lineNumber.trim(), 10);
3209
+ if (line.kind === "+") {
3210
+ if (Number.isFinite(lineNumber) && lineNumber > 0) rows.push({ index, lineNumber });
3211
+ lineDelta++;
3212
+ } else if (line.kind === "-") {
3213
+ lineDelta--;
3214
+ } else if (Number.isFinite(lineNumber)) {
3215
+ const translated = lineNumber + lineDelta;
3216
+ if (translated > 0) rows.push({ index, lineNumber: translated });
3217
+ }
3218
+ }
3219
+ return rows;
3220
+ };
3202
3221
  var highlightRemovedDiffLines = (parsed, filePath, language, cwd, invalidate) => {
3203
3222
  let start = 0;
3204
3223
  while (start < parsed.length && !parsed[start]) start++;
@@ -3275,16 +3294,17 @@ var renderDiff = (diff, filePath, theme, options, limitOverride) => {
3275
3294
  const highlighted = Array.from({ length: shown.length }, () => void 0);
3276
3295
  if (language) {
3277
3296
  if (filePath) {
3278
- const numbered = [];
3279
- for (let index = 0; index < parsed.length; index++) {
3280
- const line = parsed[index];
3281
- if (!line) continue;
3282
- const n = Number.parseInt(line.lineNumber.trim(), 10);
3283
- if (Number.isFinite(n) && n > 0) numbered.push({ index, n });
3284
- }
3297
+ const numbered = postEditFileRows(parsed);
3285
3298
  if (numbered.length > 0) {
3286
- const from = Math.min(...numbered.map((row) => row.n)) - 1;
3287
- const to = Math.max(...numbered.map((row) => row.n)) + 1;
3299
+ let from = numbered[0].lineNumber;
3300
+ let to = from;
3301
+ for (let index = 1; index < numbered.length; index++) {
3302
+ const lineNumber = numbered[index].lineNumber;
3303
+ from = Math.min(from, lineNumber);
3304
+ to = Math.max(to, lineNumber);
3305
+ }
3306
+ from--;
3307
+ to++;
3288
3308
  const slice = highlightFileLines(
3289
3309
  resolve(options.cwd, filePath),
3290
3310
  language,
@@ -3294,7 +3314,7 @@ var renderDiff = (diff, filePath, theme, options, limitOverride) => {
3294
3314
  );
3295
3315
  if (slice) {
3296
3316
  for (const row of numbered) {
3297
- const entry = slice[row.n - 1 - from];
3317
+ const entry = slice[row.lineNumber - 1 - from];
3298
3318
  if (entry && entry.raw === expandTabs(parsed[row.index].content)) {
3299
3319
  highlighted[row.index] = entry.ansi;
3300
3320
  }
@@ -4960,4 +4980,4 @@ export {
4960
4980
  isActiveStatus,
4961
4981
  orderAgentsByCreation
4962
4982
  };
4963
- //# sourceMappingURL=chunk-RRBCG2MS.js.map
4983
+ //# sourceMappingURL=chunk-ZQMNKN4L.js.map