@eliya-oss/agent-diff 0.1.0-alpha.130 → 0.1.0-alpha.132

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 (3) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/main.js +140 -36
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.132
4
+
5
+ ### Patch Changes
6
+
7
+ - Five things the layers rail got wrong about where you are.
8
+
9
+ Collapsing the layer you are reading took the cursor off the rail entirely — nothing said where you were, and the layer looked unstarted. A collapsed layer holding the cursor now carries it on its title row.
10
+
11
+ After `r` picked up layers the agent had rewritten, the layer holding your file was collapsed, the rail had no cursor, and `l` did nothing at all, because both were still keyed to the layer index from before the reload.
12
+
13
+ A first layer whose files are not in the diff — one bad path from the agent — opened the review at the *last* file of the reading order instead of the first.
14
+
15
+ A file two layers both claim reported the position of its first appearance, so the counter read `file 1 of 3` at the end of the walk, and `]` looked dead on the press that moved between the two copies. The cursor bar was also drawn on that file in every layer naming it, so the rail could not say which layer you were reading.
16
+
17
+ A layer whose spans name nothing in the diff drew a bare title with no explanation and lost its note. It now says what it was pointing at, and shows the note, since there is no file for the diff to carry it against.
18
+
19
+ ## 0.1.0-alpha.131
20
+
21
+ ### Patch Changes
22
+
23
+ - A file whose content did not change says what did. Making a file executable, or renaming it, showed a diff pane containing a single bare line number and nothing else — no cursor, no explanation, and `j` did nothing because the pane had no rows. git reports both; adiff dropped the lines. It now says `mode changed, 100644 to 100755` or `renamed from pkg/gizmo.ts`, and shows the diff underneath when there is one.
24
+
25
+ That bare line number was a patch with no rows being given one blank display row and numbering it. No patch can end up with no rows now, and a row that sits on no line of either side no longer borrows a number — which also cleans up the "no newline at end of file" marker.
26
+
3
27
  ## 0.1.0-alpha.130
4
28
 
5
29
  ### Patch Changes
package/dist/main.js CHANGED
@@ -9414,9 +9414,9 @@ var init_service$1 = __esmMin((() => {
9414
9414
  };
9415
9415
  };
9416
9416
  STATE_LOCK = {
9417
- tries: 240,
9417
+ tries: 1200,
9418
9418
  waitMs: 25,
9419
- staleMs: 15e3
9419
+ staleMs: 3e4
9420
9420
  };
9421
9421
  DRAFTS_LOCK = {
9422
9422
  tries: 600,
@@ -9584,7 +9584,7 @@ var init_anchor = __esmMin((() => {
9584
9584
  }));
9585
9585
  //#endregion
9586
9586
  //#region src/domain/patch/parse.ts
9587
- var FILE_MARKER, HUNK_MARKER, BINARY_MARKER, NO_NEWLINE_MARKER, NO_NEWLINE_SAID, BINARY_SAID, BLOB_MARKER, OLD_PATH_MARKER, NEW_PATH_MARKER, HUNK_HEADER, FILE_HEADER, SIGNS$1, draftFrom, openHunk, appendRow, appendMarker, readBody, readBinary, readHeader, parsePatches;
9587
+ var FILE_MARKER, HUNK_MARKER, BINARY_MARKER, NO_NEWLINE_MARKER, NO_NEWLINE_SAID, BINARY_SAID, MODE_OLD_MARKER, MODE_NEW_MARKER, FILE_ADDED_MARKER, FILE_GONE_MARKER, EMPTY_ADDED_SAID, EMPTY_GONE_SAID, NOTHING_SAID, BLOB_MARKER, OLD_PATH_MARKER, NEW_PATH_MARKER, HUNK_HEADER, FILE_HEADER, SIGNS$1, MADE_SAID, FROM_MARKERS, draftFrom, openHunk, appendRow, appendMarker, readBody, openPlain, told$1, notesOf$1, readMode, readMeta, readBinary, readHeader, readLine, parsePatches;
9588
9588
  var init_parse$1 = __esmMin((() => {
9589
9589
  init_dist();
9590
9590
  FILE_MARKER = "diff --git ";
@@ -9593,6 +9593,13 @@ var init_parse$1 = __esmMin((() => {
9593
9593
  NO_NEWLINE_MARKER = "\";
9594
9594
  NO_NEWLINE_SAID = "no newline at end of file";
9595
9595
  BINARY_SAID = "binary file, adiff cannot show what changed in it";
9596
+ MODE_OLD_MARKER = "old mode ";
9597
+ MODE_NEW_MARKER = "new mode ";
9598
+ FILE_ADDED_MARKER = "new file mode ";
9599
+ FILE_GONE_MARKER = "deleted file mode ";
9600
+ EMPTY_ADDED_SAID = "added an empty file";
9601
+ EMPTY_GONE_SAID = "deleted an empty file";
9602
+ NOTHING_SAID = "no lines changed";
9596
9603
  BLOB_MARKER = "index ";
9597
9604
  OLD_PATH_MARKER = "--- ";
9598
9605
  NEW_PATH_MARKER = "+++ ";
@@ -9603,6 +9610,18 @@ var init_parse$1 = __esmMin((() => {
9603
9610
  "+": "added",
9604
9611
  "-": "removed"
9605
9612
  };
9613
+ MADE_SAID = {
9614
+ added: EMPTY_ADDED_SAID,
9615
+ deleted: EMPTY_GONE_SAID,
9616
+ changed: NOTHING_SAID
9617
+ };
9618
+ FROM_MARKERS = [{
9619
+ marker: "rename from ",
9620
+ said: "renamed from"
9621
+ }, {
9622
+ marker: "copy from ",
9623
+ said: "copied from"
9624
+ }];
9606
9625
  draftFrom = (line) => {
9607
9626
  const named = FILE_HEADER.exec(line);
9608
9627
  return {
@@ -9610,6 +9629,9 @@ var init_parse$1 = __esmMin((() => {
9610
9629
  previousPath: named?.[1] ?? "",
9611
9630
  blob: "",
9612
9631
  headerLines: [line],
9632
+ notes: [],
9633
+ oldMode: "",
9634
+ made: "changed",
9613
9635
  hunks: [],
9614
9636
  rows: [],
9615
9637
  added: 0,
@@ -9666,16 +9688,47 @@ var init_parse$1 = __esmMin((() => {
9666
9688
  const kind = SIGNS$1[line.slice(0, 1)];
9667
9689
  if (kind !== void 0) appendRow(draft, kind, line.slice(1));
9668
9690
  };
9669
- readBinary = (draft, line) => {
9670
- if (!line.startsWith(BINARY_MARKER)) return false;
9691
+ openPlain = (draft) => {
9671
9692
  draft.hunks.push({
9672
9693
  marker: "",
9673
9694
  scope: "",
9674
- startRow: 0,
9695
+ startRow: draft.rows.length,
9675
9696
  newStart: 1,
9676
9697
  rows: [],
9677
9698
  skipped: 0
9678
9699
  });
9700
+ };
9701
+ told$1 = (draft, said) => {
9702
+ if (draft.hunks.length > 0 || said.length === 0) return;
9703
+ openPlain(draft);
9704
+ for (const text of said) appendMarker(draft, text);
9705
+ };
9706
+ notesOf$1 = (draft) => draft.notes.length > 0 ? draft.notes : [MADE_SAID[draft.made]];
9707
+ readMode = (draft, line) => {
9708
+ if (line.startsWith(MODE_OLD_MARKER)) {
9709
+ draft.oldMode = line.slice(9).trim();
9710
+ return true;
9711
+ }
9712
+ if (!line.startsWith(MODE_NEW_MARKER)) return false;
9713
+ const now = line.slice(9).trim();
9714
+ draft.notes.push(`mode changed, ${draft.oldMode} to ${now}`);
9715
+ return true;
9716
+ };
9717
+ readMeta = (draft, line) => {
9718
+ if (readMode(draft, line)) return true;
9719
+ if (line.startsWith(FILE_ADDED_MARKER) || line.startsWith(FILE_GONE_MARKER)) {
9720
+ draft.made = line.startsWith(FILE_ADDED_MARKER) ? "added" : "deleted";
9721
+ return true;
9722
+ }
9723
+ const from = FROM_MARKERS.find((entry) => line.startsWith(entry.marker));
9724
+ if (from === void 0) return false;
9725
+ draft.notes.push(`${from.said} ${line.slice(from.marker.length)}`);
9726
+ return true;
9727
+ };
9728
+ readBinary = (draft, line) => {
9729
+ if (!line.startsWith(BINARY_MARKER)) return false;
9730
+ told$1(draft, draft.notes);
9731
+ openPlain(draft);
9679
9732
  appendRow(draft, "context", BINARY_SAID);
9680
9733
  return true;
9681
9734
  };
@@ -9691,6 +9744,17 @@ var init_parse$1 = __esmMin((() => {
9691
9744
  }
9692
9745
  return false;
9693
9746
  };
9747
+ readLine = (draft, line) => {
9748
+ if (readHeader(draft, line)) return;
9749
+ if (readMeta(draft, line)) return;
9750
+ if (readBinary(draft, line)) return;
9751
+ if (!line.startsWith(HUNK_MARKER)) {
9752
+ readBody(draft, line);
9753
+ return;
9754
+ }
9755
+ told$1(draft, draft.notes);
9756
+ openHunk(draft, line);
9757
+ };
9694
9758
  parsePatches = (diff) => {
9695
9759
  const drafts = [];
9696
9760
  for (const line of diff.split("\n")) {
@@ -9699,12 +9763,9 @@ var init_parse$1 = __esmMin((() => {
9699
9763
  continue;
9700
9764
  }
9701
9765
  const draft = drafts.at(-1);
9702
- if (draft === void 0) continue;
9703
- if (readHeader(draft, line)) continue;
9704
- if (readBinary(draft, line)) continue;
9705
- if (line.startsWith(HUNK_MARKER)) openHunk(draft, line);
9706
- else readBody(draft, line);
9766
+ if (draft !== void 0) readLine(draft, line);
9707
9767
  }
9768
+ for (const draft of drafts) told$1(draft, notesOf$1(draft));
9708
9769
  return drafts;
9709
9770
  };
9710
9771
  }));
@@ -10985,7 +11046,7 @@ var init_pane = __esmMin((() => {
10985
11046
  init_drafts();
10986
11047
  init_init();
10987
11048
  init_pane();
10988
- var version$1 = "0.1.0-alpha.130";
11049
+ var version$1 = "0.1.0-alpha.132";
10989
11050
  //#endregion
10990
11051
  //#region src/cli/upgrade.ts
10991
11052
  var PACKAGE, TAG, RELEASES, REGISTRY, ASK_MS, RUN_MS, CELLAR, COMPILED, INSTALLED, BUN_GLOBAL, routeOf, ROUTES, asRoute, checkoutOf, assetOf, commandFor, NOTES, RUNNABLE, NUMBERS, numbersIn, compare$1, partsOf, newer, tagIn, fetched, askLatest, here, findUpgrade, willUpgrade, ranChild, runUpgrade, statusOf$1, sayFound, sayDone, attempted, REFRESH_MS, refreshSkills, updatedIn, sayRefreshed, upgradeReport;
@@ -13018,7 +13079,7 @@ var init_tree = __esmMin((() => {
13018
13079
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
13019
13080
  };
13020
13081
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
13021
- })), nothingReviewed, initialState, TREE_MAX, TREE_ROOMY, TREE_WIDE, TREE_MIN, TREE_SHARE, DIFF_MIN, DIFF_ROOMY, bodyRoom, treeWidth, tooSmall, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, kept, layerHolds, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, clip, TITLE_ROWS, titleRows, shortDir, fileRow$1, shownFiles, dirOf, fileRows, layerRead, layerDone, countRow, layerBody, layerRows, nearFirst, layerFitted, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, treeOf, reviewedCountIn, CROWDED, treeRows, crowdedOf, foldersOfFile, isReviewed, treeStart, treeWindow, threadStand, STAND_WEIGHT, louder, threadsOn, hiddenLines, rowsUnder, markedStands, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, brokenAt, laidLine, laidDraft, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, replyTarget, threadReplying, VOICES, threadQuote, pickedText, takenRows, selectedLines, shownMatches, matchHere, selectionReadout, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadHere, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, PANEL_SECTIONS, answersIn, newerOf, spokeLast, SECTION_OF, sectionOf, sentEntry, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, readingOrder, placeIn, layerFile, layerAfter, selectionRange;
13082
+ })), nothingReviewed, initialState, TREE_MAX, TREE_ROOMY, TREE_WIDE, TREE_MIN, TREE_SHARE, DIFF_MIN, DIFF_ROOMY, bodyRoom, treeWidth, tooSmall, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, kept, layerHolds, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, clip, TITLE_ROWS, titleRows, shortDir, fileRow$1, shownFiles, dirOf, fileRows, layerRead, layerDone, countRow, NOTHING_LEFT, textRows, emptyRows, layerBody, holdsCursor, layerCard, layerRows, nearFirst, layerFitted, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, treeOf, reviewedCountIn, CROWDED, treeRows, crowdedOf, foldersOfFile, isReviewed, treeStart, treeWindow, threadStand, STAND_WEIGHT, louder, threadsOn, hiddenLines, rowsUnder, markedStands, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, brokenAt, laidLine, laidDraft, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, replyTarget, threadReplying, VOICES, threadQuote, pickedText, takenRows, selectedLines, shownMatches, matchHere, selectionReadout, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadHere, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, PANEL_SECTIONS, answersIn, newerOf, spokeLast, SECTION_OF, sectionOf, sentEntry, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, readingOrder, placeIn, layerFile, layerAfter, selectionRange;
13022
13083
  var init_model = __esmMin((() => {
13023
13084
  init_dist();
13024
13085
  init_patch();
@@ -13146,7 +13207,7 @@ var init_model = __esmMin((() => {
13146
13207
  };
13147
13208
  clip = (label, room) => label.length > room ? `${label.slice(0, Math.max(0, room - 1))}…` : label;
13148
13209
  TITLE_ROWS = 2;
13149
- titleRows = (state, layerIndex, room) => {
13210
+ titleRows = (state, layerIndex, room, marked) => {
13150
13211
  const lines = wordWrapped(state.layers[layerIndex]?.title ?? "", room);
13151
13212
  const heldLines = lines.slice(0, TITLE_ROWS);
13152
13213
  const last = heldLines.at(-1) ?? "";
@@ -13154,7 +13215,8 @@ var init_model = __esmMin((() => {
13154
13215
  index: layerIndex,
13155
13216
  kind: "title",
13156
13217
  text,
13157
- lead: at === 0
13218
+ lead: at === 0,
13219
+ here: at === 0 && marked
13158
13220
  }));
13159
13221
  };
13160
13222
  shortDir = (dir, room) => {
@@ -13174,7 +13236,7 @@ var init_model = __esmMin((() => {
13174
13236
  lead: false,
13175
13237
  fileIndex: at,
13176
13238
  reviewed: isReviewed(state, at),
13177
- here: at === state.patchIndex
13239
+ here: at === state.patchIndex && layerIndex === state.layerIndex
13178
13240
  };
13179
13241
  };
13180
13242
  shownFiles = (state, layerIndex) => layerFiles(state, layerIndex).filter((at) => !(state.hideReviewed && isReviewed(state, at) && at !== state.patchIndex));
@@ -13220,21 +13282,38 @@ var init_model = __esmMin((() => {
13220
13282
  lead: false
13221
13283
  }];
13222
13284
  };
13285
+ NOTHING_LEFT = "nothing in this diff";
13286
+ textRows = (index, text, room, kind) => wrapped(text, room).map((line) => ({
13287
+ index,
13288
+ kind,
13289
+ text: line,
13290
+ lead: false
13291
+ }));
13292
+ emptyRows = (state, index, room) => {
13293
+ const layer = state.layers[index];
13294
+ if (layer === void 0) return [];
13295
+ const gone = layer.vanished;
13296
+ const said = gone.length === 0 ? NOTHING_LEFT : `${NOTHING_LEFT}: ${gone.join(", ")}`;
13297
+ return [...textRows(index, said, room, "count"), ...textRows(index, layer.note, room, "note")];
13298
+ };
13223
13299
  layerBody = (state, index, room, shown) => {
13300
+ if (layerRead(state, index).all === 0) return emptyRows(state, index, room.file);
13224
13301
  if (!layerOpen(state, index) || !shown.has(index)) return countRow(state, index, room.file);
13225
13302
  const rows = fileRows(state, index, room);
13226
13303
  return rows.length > 0 ? rows : countRow(state, index, room.file);
13227
13304
  };
13228
- layerRows = (state, room, shown) => state.layers.flatMap((_, index) => [
13229
- ...index > 0 ? [{
13230
- index,
13231
- kind: "gap",
13232
- text: "",
13233
- lead: false
13234
- }] : [],
13235
- ...titleRows(state, index, room.title),
13236
- ...layerBody(state, index, room, shown)
13237
- ]);
13305
+ holdsCursor = (state, index) => index === state.layerIndex && layerFiles(state, index).includes(state.patchIndex);
13306
+ layerCard = (state, index, room, shown) => {
13307
+ const body = layerBody(state, index, room, shown);
13308
+ const marked = holdsCursor(state, index) && !body.some((row) => row.here === true);
13309
+ return [...titleRows(state, index, room.title, marked), ...body];
13310
+ };
13311
+ layerRows = (state, room, shown) => state.layers.flatMap((_, index) => [...index > 0 ? [{
13312
+ index,
13313
+ kind: "gap",
13314
+ text: "",
13315
+ lead: false
13316
+ }] : [], ...layerCard(state, index, room, shown)]);
13238
13317
  nearFirst = (state) => state.layers.map((_, at) => at).filter((at) => layerOpen(state, at)).toSorted((one, two) => Math.abs(one - state.layerIndex) - Math.abs(two - state.layerIndex));
13239
13318
  layerFitted = (state, room, height) => {
13240
13319
  const every = new Set(state.layers.map((_, at) => at));
@@ -13617,8 +13696,8 @@ var init_model = __esmMin((() => {
13617
13696
  reviewedCount = (state) => `${state.vouched.length} reviewed`;
13618
13697
  fileOrder = (state) => onLayers(state) ? state.layers.flatMap((_, at) => layerFiles(state, at)) : flattenTree(treeOf(state), []).flatMap((row) => row.fileIndex === void 0 ? [] : [row.fileIndex]);
13619
13698
  filePlace = (state) => {
13620
- const order = [...new Set(fileOrder(state))];
13621
- const at = order.indexOf(state.patchIndex);
13699
+ const order = readingOrder(state);
13700
+ const at = placeIn(state);
13622
13701
  if (at === -1) return {
13623
13702
  at: state.patchIndex + 1,
13624
13703
  of: state.patches.length
@@ -14508,7 +14587,7 @@ var init_match = __esmMin((() => {
14508
14587
  }));
14509
14588
  //#endregion
14510
14589
  //#region src/tui/reduce.ts
14511
- var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, restingOn, draggedTo, pickedIn, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, moveLayer, inRail, railScrolled, movePanel, layerDown, stepsToEnd, toTop, farOff, byHalf, boundedStep, PANEL_FAR, PANES, panesShown, focusStepped, togglePanel, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, landingOn, revealing, atTheEnd, moveFile, selectHunk, swapEnds, atBranch, grownBy, startSelection, draftMark, openCompose, outOfDiff, goBack, walkMatches, openPalette, openKeys, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, resumedAt, atFile, withContext, withFull, allRevealed, revealsAfter, gapShown, gapOpened, panBy, withSent, withArrived, withColumns, laidOver, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, openedAt, withPatches, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, withDraft, paletteMoved, paletteClosed, withWaiting, withFinder, withMatches, withNoticeHere, withNotice;
14590
+ var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, restingOn, draggedTo, pickedIn, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, moveLayer, inRail, railScrolled, movePanel, layerDown, stepsToEnd, toTop, farOff, byHalf, boundedStep, PANEL_FAR, PANES, panesShown, focusStepped, togglePanel, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, landingOn, revealing, atTheEnd, moveFile, selectHunk, swapEnds, atBranch, grownBy, startSelection, draftMark, openCompose, outOfDiff, goBack, walkMatches, openPalette, openKeys, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, resumedAt, atFile, withContext, withFull, allRevealed, revealsAfter, gapShown, gapOpened, panBy, withSent, withArrived, withColumns, laidOver, onLayerHolding, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, openedAt, withPatches, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, withDraft, paletteMoved, paletteClosed, withWaiting, withFinder, withMatches, withNoticeHere, withNotice;
14512
14591
  var init_reduce = __esmMin((() => {
14513
14592
  init_dist();
14514
14593
  init_patch();
@@ -15162,14 +15241,27 @@ var init_reduce = __esmMin((() => {
15162
15241
  openLayers: anew ? told.layers.map((_, at) => at) : state.openLayers.filter((at) => at < told.layers.length),
15163
15242
  rail: told.layers.length === 0 ? "tree" : anew ? "layers" : state.rail
15164
15243
  });
15244
+ onLayerHolding = (state) => {
15245
+ if (!onLayers(state)) return state;
15246
+ const layer = layerHolding(state, state.patchIndex);
15247
+ return {
15248
+ ...state,
15249
+ layerIndex: layer,
15250
+ openLayers: state.openLayers.includes(layer) ? state.openLayers : [...state.openLayers, layer]
15251
+ };
15252
+ };
15165
15253
  withLayers = (state, told) => {
15166
15254
  const layers = told.layers;
15167
15255
  const anew = state.layers.length === 0;
15168
15256
  const opened = laidOver(state, told, anew);
15169
- if (layers.length === 0 || !anew) return opened;
15257
+ if (layers.length === 0) return opened;
15258
+ if (!anew) return onLayerHolding(opened);
15259
+ const first = readingOrder(opened)[0];
15260
+ if (first === void 0) return opened;
15170
15261
  return {
15171
15262
  ...opened,
15172
- patchIndex: layerFiles(opened, 0)[0] ?? opened.patchIndex,
15263
+ layerIndex: first.layer,
15264
+ patchIndex: first.file,
15173
15265
  cursor: 0,
15174
15266
  top: 0
15175
15267
  };
@@ -15202,12 +15294,12 @@ var init_reduce = __esmMin((() => {
15202
15294
  if (patch === void 0) return state;
15203
15295
  const cursor = line === void 0 ? 0 : rowAtSourceLine(patch, line);
15204
15296
  const top = clamp(cursor - Math.max(0, offset), 0, Math.max(0, patch.rows.length - 1));
15205
- return withCursorVisible({
15297
+ return withCursorVisible(onLayerHolding({
15206
15298
  ...state,
15207
15299
  patchIndex: index,
15208
15300
  cursor,
15209
15301
  top
15210
- });
15302
+ }));
15211
15303
  };
15212
15304
  openedAt = (state, patchIndex, line) => {
15213
15305
  const landed = {
@@ -15456,7 +15548,7 @@ var init_theme = __esmMin((() => {
15456
15548
  }));
15457
15549
  //#endregion
15458
15550
  //#region src/tui/diffview.ts
15459
- var WASH, NOTE_MIN, ANSWER_MARK, REPLY_MARK, OVERSCAN, SIGN_WIDTH, SCROLL_ROWS, PAN_COLUMNS, WAYS, notchesIn, takenOver, wheelTo, SIGNS, numberFor, DiffView, startsOf, bareOf, noteKey, keyOf, groupOf, isChrome, alike, heldAt, sameLine, NO_SPANS, lineStarts, overLine, shifted, acrossLines, spansByLine, textAt, noteSpans, NOTE_PAINT, wrap, headOf, spokenLines, answerLines, noteLines, noteRows, proseRows, freshLines, proseAt, notesAt, TRAILING, shownText, codeRow, rowsFor, replacedBy, layout, lineNumbers, BARE_SIGN, signFor, lineSigns, sideLineOf;
15551
+ var WASH, NOTE_MIN, ANSWER_MARK, REPLY_MARK, OVERSCAN, SIGN_WIDTH, SCROLL_ROWS, PAN_COLUMNS, WAYS, notchesIn, takenOver, wheelTo, SIGNS, numberFor, DiffView, startsOf, numbered, bareOf, noteKey, keyOf, groupOf, isChrome, alike, heldAt, sameLine, NO_SPANS, lineStarts, overLine, shifted, acrossLines, spansByLine, textAt, noteSpans, NOTE_PAINT, wrap, headOf, spokenLines, answerLines, noteLines, noteRows, proseRows, freshLines, proseAt, notesAt, TRAILING, shownText, codeRow, rowsFor, replacedBy, layout, lineNumbers, BARE_SIGN, signFor, lineSigns, sideLineOf;
15460
15552
  var init_diffview = __esmMin((() => {
15461
15553
  init_dist();
15462
15554
  init_patch();
@@ -15674,7 +15766,7 @@ var init_diffview = __esmMin((() => {
15674
15766
  this.code.filetype = pathToFiletype(patch.path) ?? "text";
15675
15767
  this.feed();
15676
15768
  this.numbers.setLineNumbers(lineNumbers(patch, this.display));
15677
- this.numbers.setHideLineNumbers(bareOf(this.display));
15769
+ this.numbers.setHideLineNumbers(bareOf(patch, this.display));
15678
15770
  this.numbers.setLineSigns(lineSigns(patch, this.display));
15679
15771
  this.numbers.setLineColors(/* @__PURE__ */ new Map());
15680
15772
  }
@@ -15903,7 +15995,14 @@ var init_diffview = __esmMin((() => {
15903
15995
  for (const [index, entry] of display.entries()) if (!entry.comment && !starts.has(entry.row)) starts.set(entry.row, index);
15904
15996
  return starts;
15905
15997
  };
15906
- bareOf = (display) => new Set(display.flatMap((entry, index) => entry.comment || entry.gap || entry.prose ? [index] : []));
15998
+ numbered = (rows, entry) => {
15999
+ const row = rows.get(entry.row);
16000
+ return row !== void 0 && numberFor(row) !== void 0;
16001
+ };
16002
+ bareOf = (patch, display) => {
16003
+ const rows = new Map(patch.rows.map((row) => [row.index, row]));
16004
+ return new Set(display.flatMap((entry, index) => entry.comment || entry.gap || entry.prose || !numbered(rows, entry) ? [index] : []));
16005
+ };
15907
16006
  noteKey = (note) => [
15908
16007
  `${note.side}${note.line}:${note.folded ? "-" : "+"}${note.body}`,
15909
16008
  note.settled ? "settled" : note.asks ? "asked" : "open",
@@ -16861,6 +16960,11 @@ var init_render = __esmMin((() => {
16861
16960
  mark: " ",
16862
16961
  paint: palette.faint
16863
16962
  };
16963
+ case "note": return {
16964
+ lead: FILE_LEAD,
16965
+ mark: " ",
16966
+ paint: palette.muted
16967
+ };
16864
16968
  case "title": return titleLook(state, row);
16865
16969
  default: return absurd(row.kind);
16866
16970
  }
package/package.json CHANGED
@@ -23,7 +23,7 @@
23
23
  "bin": {
24
24
  "adiff": "./bin/adiff.js"
25
25
  },
26
- "version": "0.1.0-alpha.130",
26
+ "version": "0.1.0-alpha.132",
27
27
  "description": "Review the work an agent left you without losing the thread: comments live on the lines, the agent answers them, and each point stays open until you settle it.",
28
28
  "license": "MIT",
29
29
  "repository": {