@eliya-oss/agent-diff 0.1.0-alpha.70 → 0.1.0-alpha.72

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 +12 -0
  2. package/dist/main.js +194 -36
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.72
4
+
5
+ ### Patch Changes
6
+
7
+ - Dragging inside one line copies the characters it covered. The wheel belongs to the review again, so scrolling and then pressing an arrow no longer throws the view back. `S` turns the pinned scope off. Settling from the panel keeps the cursor on the thread it settled.
8
+
9
+ ## 0.1.0-alpha.71
10
+
11
+ ### Patch Changes
12
+
13
+ - `f` on the review panel hides the threads already settled, the way it hides files already read on the file list. The same key puts away what is done in whichever pane is in focus.
14
+
3
15
  ## 0.1.0-alpha.70
4
16
 
5
17
  ### Patch Changes
package/dist/main.js CHANGED
@@ -8674,7 +8674,10 @@ var init_schema = __esmMin((() => {
8674
8674
  base: optionalKey(String$1),
8675
8675
  read: optionalKey(Record(String$1, Int))
8676
8676
  });
8677
- Settings = Struct({ wrap: optionalKey(Boolean) });
8677
+ Settings = Struct({
8678
+ wrap: optionalKey(Boolean),
8679
+ sticky: optionalKey(Boolean)
8680
+ });
8678
8681
  UpgradeCheck = Struct({
8679
8682
  note: optionalKey(String$1),
8680
8683
  checkedAt: optionalKey(String$1),
@@ -9046,7 +9049,7 @@ var init_error$1 = __esmMin((() => {
9046
9049
  }));
9047
9050
  //#endregion
9048
9051
  //#region src/cli/commands.ts
9049
- var CONTEXT, WHOLE_FILE$1, POLL, AUTO, askedFor, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, rowsCovering, waitingOn, listBranches, blobOf, toggleVouch, reviewProgress, bodyOf, sentOf, listSent, submitComment, listPatches, flatten, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, saveWrap, setBase, clearBase, markRead;
9052
+ var CONTEXT, WHOLE_FILE$1, POLL, AUTO, askedFor, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, rowsCovering, waitingOn, listBranches, blobOf, toggleVouch, reviewProgress, bodyOf, sentOf, listSent, submitComment, listPatches, flatten, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, saveWrap, saveSticky, setBase, clearBase, markRead;
9050
9053
  var init_commands = __esmMin((() => {
9051
9054
  init_dist();
9052
9055
  init_patch();
@@ -9345,6 +9348,14 @@ var init_commands = __esmMin((() => {
9345
9348
  wrap
9346
9349
  });
9347
9350
  });
9351
+ saveSticky = fn("Cli.saveSticky")(function* (sticky) {
9352
+ const store = yield* Store;
9353
+ const current = yield* store.settings;
9354
+ yield* store.saveSettings({
9355
+ ...current,
9356
+ sticky
9357
+ });
9358
+ });
9348
9359
  setBase = fn("Cli.setBase")(function* (repo, branch, base) {
9349
9360
  const store = yield* Store;
9350
9361
  const based = yield* baseFor(repo, branch, base);
@@ -9650,7 +9661,7 @@ var init_pane = __esmMin((() => {
9650
9661
  init_commands();
9651
9662
  init_init();
9652
9663
  init_pane();
9653
- var version$1 = "0.1.0-alpha.70";
9664
+ var version$1 = "0.1.0-alpha.72";
9654
9665
  //#endregion
9655
9666
  //#region src/cli/upgrade.ts
9656
9667
  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, runUpgrade, statusOf$1, sayFound, sayDone, attempted, REFRESH_MS, refreshSkills, updatedIn, sayRefreshed, upgradeReport;
@@ -11383,7 +11394,7 @@ var init_tree = __esmMin((() => {
11383
11394
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
11384
11395
  };
11385
11396
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
11386
- })), nothingReviewed, initialState, TREE_MAX, TREE_MIN, TREE_SHARE, DIFF_MIN, DIFF_ROOMY, bodyRoom, treeWidth, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, NO_NOTE, noteRows$1, proseRow, proseRows$1, titleRows, clipEnd, FILE_LEAD, fileRows, layerRows, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, kept, treeOf, reviewedCountIn, treeRows, crowdedOf, foldersOfFile, isReviewed, treeStart, treeWindow, commentsOn, hiddenLines, markedRows, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, caretAt, drafted, WORD, wordLeft, wordRight, caretByWord, lineStart, lineEnd, caretToEdge, composeTarget, selectedLines, KEYWORDS, NAME, longestName$1, searchTerm, matchHere, selectionReadout, WHOLE_FILE, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, answersIn, newerOf, sectionOf, sentEntry, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, changeAround, nextUnreviewed, reviewedCount, fileOrder, layerFile, selectionRange;
11397
+ })), nothingReviewed, initialState, TREE_MAX, TREE_MIN, TREE_SHARE, DIFF_MIN, DIFF_ROOMY, bodyRoom, treeWidth, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, NO_NOTE, noteRows$1, proseRow, proseRows$1, titleRows, clipEnd, FILE_LEAD, fileRows, layerRows, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, kept, treeOf, reviewedCountIn, treeRows, crowdedOf, foldersOfFile, isReviewed, treeStart, treeWindow, commentsOn, hiddenLines, markedRows, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, caretAt, drafted, WORD, wordLeft, wordRight, caretByWord, lineStart, lineEnd, caretToEdge, composeTarget, pickedText, selectedLines, KEYWORDS, NAME, longestName$1, searchTerm, matchHere, selectionReadout, WHOLE_FILE, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, answersIn, newerOf, sectionOf, sentEntry, panelEntries, panelIndexOf, panelEntry, threadChosen, spokenSince, hunkStarts, changeAround, nextUnreviewed, reviewedCount, fileOrder, layerFile, selectionRange;
11387
11398
  var init_model = __esmMin((() => {
11388
11399
  init_dist();
11389
11400
  init_patch();
@@ -11397,6 +11408,8 @@ var init_model = __esmMin((() => {
11397
11408
  columns: 0,
11398
11409
  reportFull: true,
11399
11410
  hideReviewed: false,
11411
+ hideSettled: false,
11412
+ picked: void 0,
11400
11413
  newestFirst: true,
11401
11414
  tallest: 0,
11402
11415
  scroll: -1,
@@ -11435,6 +11448,7 @@ var init_model = __esmMin((() => {
11435
11448
  focus: "diff",
11436
11449
  navOpen: true,
11437
11450
  wrap: false,
11451
+ sticky: true,
11438
11452
  pan: 0,
11439
11453
  layers: [],
11440
11454
  layersStale: false,
@@ -11674,6 +11688,15 @@ var init_model = __esmMin((() => {
11674
11688
  });
11675
11689
  return span === "" ? `Comment on ${patch.path}` : `Comment on ${patch.path}:${span}`;
11676
11690
  };
11691
+ pickedText = (state) => {
11692
+ const picked = state.picked;
11693
+ const patch = selectedPatch(state);
11694
+ if (picked === void 0 || patch === void 0) return void 0;
11695
+ const text = patch.rows[picked.row]?.text;
11696
+ if (text === void 0) return void 0;
11697
+ const taken = text.slice(picked.from, picked.to);
11698
+ return taken.length === 0 ? void 0 : taken;
11699
+ };
11677
11700
  selectedLines = (state) => {
11678
11701
  const patch = selectedPatch(state);
11679
11702
  if (patch === void 0) return [];
@@ -11826,13 +11849,18 @@ var init_model = __esmMin((() => {
11826
11849
  };
11827
11850
  };
11828
11851
  panelEntries = (state) => {
11829
- const delivered = state.sent.map((comment) => sentEntry(state, comment));
11852
+ const delivered = (state.hideSettled ? state.sent.filter((comment) => comment.settled !== true) : state.sent).map((comment) => sentEntry(state, comment));
11830
11853
  const ordered = (section) => {
11831
11854
  const found = delivered.filter((entry) => entry.section === section);
11832
11855
  return state.newestFirst ? found.toReversed() : found;
11833
11856
  };
11834
11857
  return [...ordered("with"), ...ordered("answered")];
11835
11858
  };
11859
+ panelIndexOf = (state, id) => {
11860
+ if (id === void 0) return state.panelIndex;
11861
+ const at = panelEntries(state).findIndex((entry) => entry.comment.id === id);
11862
+ return at === -1 ? state.panelIndex : at;
11863
+ };
11836
11864
  panelEntry = (state) => panelEntries(state)[state.panelIndex];
11837
11865
  threadChosen = (state) => {
11838
11866
  if (state.focus !== "review") return void 0;
@@ -12241,6 +12269,14 @@ var init_command = __esmMin((() => {
12241
12269
  keys: ["o"],
12242
12270
  screens: ["review"]
12243
12271
  }),
12272
+ command({
12273
+ action: "sticky.toggle",
12274
+ panes: ["diff"],
12275
+ title: "Show or hide the scope above the diff",
12276
+ category: "Reading",
12277
+ keys: ["S"],
12278
+ screens: ["review"]
12279
+ }),
12244
12280
  command({
12245
12281
  action: "wrap.toggle",
12246
12282
  title: "Wrap long lines",
@@ -12318,9 +12354,19 @@ var init_command = __esmMin((() => {
12318
12354
  keys: ["O"],
12319
12355
  screens: ["review"]
12320
12356
  }),
12357
+ command({
12358
+ action: "panel.winnow",
12359
+ panes: ["review"],
12360
+ title: "Hide the threads already settled",
12361
+ category: "Comments",
12362
+ keys: ["f"],
12363
+ screens: ["review"],
12364
+ hint: "hide settled",
12365
+ rank: 3
12366
+ }),
12321
12367
  command({
12322
12368
  action: "tree.winnow",
12323
- panes: ["tree"],
12369
+ panes: ["tree", "diff"],
12324
12370
  title: "Hide the files already reviewed",
12325
12371
  category: "Files",
12326
12372
  keys: ["f"],
@@ -12518,9 +12564,10 @@ var init_command = __esmMin((() => {
12518
12564
  commandsFor = (screen) => commands.filter((entry) => entry.screens.includes(screen));
12519
12565
  listableFor = (screen) => commandsFor(screen).filter((entry) => entry.listed);
12520
12566
  glossaryFor = (screen) => commandsFor(screen).toSorted((left, right) => left.category.localeCompare(right.category) || left.title.localeCompare(right.title));
12521
- actionFor = (screen, key) => {
12567
+ actionFor = (screen, key, pane) => {
12522
12568
  if (takesText(screen) && PRINTABLE_KEY.test(key)) return void 0;
12523
- return commandsFor(screen).find((entry) => entry.keys.includes(key))?.action;
12569
+ const found = commandsFor(screen).filter((entry) => entry.keys.includes(key));
12570
+ return ((pane === void 0 ? void 0 : found.find((entry) => entry.panes.includes(pane))) ?? found[0])?.action;
12524
12571
  };
12525
12572
  GLYPHS = {
12526
12573
  up: "↑",
@@ -12570,7 +12617,7 @@ var init_match = __esmMin((() => {
12570
12617
  }));
12571
12618
  //#endregion
12572
12619
  //#region src/tui/reduce.ts
12573
- var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, draggedTo, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, moveLayer, inRail, railScrolled, movePanel, layerDown, PANES, panesShown, focusStepped, togglePanel, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, moveFile, selectHunk, swapEnds, atBranch, startSelection, openCompose, goBack, walkMatches, openPalette, openKeys, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, atFile, withContext, withFull, revealsAfter, gapOpened, panBy, withSent, withArrived, withColumns, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, openedAt, withPatches, inserted, asksAQuery, typed, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, pasted, backspaced, cutBackTo, wordBackspaced, lineBackspaced, deleted, caretMoved, caretJumped, caretHomed, paletteMoved, paletteClosed, withWaiting, withMatches, withNoticeHere, withNotice;
12620
+ var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, draggedTo, pickedIn, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, moveLayer, inRail, railScrolled, movePanel, layerDown, PANES, panesShown, focusStepped, togglePanel, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, moveFile, selectHunk, swapEnds, atBranch, startSelection, openCompose, goBack, walkMatches, openPalette, openKeys, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, atFile, withContext, withFull, revealsAfter, gapOpened, panBy, withSent, withArrived, withColumns, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, openedAt, withPatches, inserted, asksAQuery, typed, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, pasted, backspaced, cutBackTo, wordBackspaced, lineBackspaced, deleted, caretMoved, caretJumped, caretHomed, paletteMoved, paletteClosed, withWaiting, withMatches, withNoticeHere, withNotice;
12574
12621
  var init_reduce = __esmMin((() => {
12575
12622
  init_dist();
12576
12623
  init_patch();
@@ -12581,7 +12628,11 @@ var init_reduce = __esmMin((() => {
12581
12628
  clamp = (value, low, high) => Math.max(low, Math.min(high, value));
12582
12629
  lastRow = (patch) => Math.max(0, (patch?.rows.length ?? 1) - 1);
12583
12630
  rowsIn = (state) => selectedPatch(state)?.rows.length ?? 0;
12584
- withCursorVisible = (state) => {
12631
+ withCursorVisible = (given) => {
12632
+ const state = given.picked === void 0 ? given : {
12633
+ ...given,
12634
+ picked: void 0
12635
+ };
12585
12636
  const height = Math.max(1, state.viewport);
12586
12637
  const highest = Math.max(0, rowsIn(state) - height);
12587
12638
  const top = state.cursor < state.top ? state.cursor : state.cursor >= state.top + height ? state.cursor - height + 1 : state.top;
@@ -12629,10 +12680,22 @@ var init_reduce = __esmMin((() => {
12629
12680
  };
12630
12681
  draggedTo = (state, from, to) => ({
12631
12682
  ...state,
12683
+ picked: void 0,
12632
12684
  selecting: true,
12633
12685
  anchorRow: clamp(from, 0, lastRow(selectedPatch(state))),
12634
12686
  cursor: clamp(to, 0, lastRow(selectedPatch(state)))
12635
12687
  });
12688
+ pickedIn = (state, row, from, to) => ({
12689
+ ...state,
12690
+ selecting: false,
12691
+ anchorRow: clamp(row, 0, lastRow(selectedPatch(state))),
12692
+ cursor: clamp(row, 0, lastRow(selectedPatch(state))),
12693
+ picked: {
12694
+ row,
12695
+ from: Math.min(from, to),
12696
+ to: Math.max(from, to)
12697
+ }
12698
+ });
12636
12699
  atRow = (state, row) => withCursorVisible({
12637
12700
  ...state,
12638
12701
  stop: 0,
@@ -12957,6 +13020,10 @@ var init_reduce = __esmMin((() => {
12957
13020
  wrap: !state.wrap,
12958
13021
  pan: 0
12959
13022
  }),
13023
+ "sticky.toggle": (state) => ({
13024
+ ...state,
13025
+ sticky: !state.sticky
13026
+ }),
12960
13027
  "pan.right": (state) => panned(state, PAN_STEP),
12961
13028
  "pan.left": (state) => panned(state, -8),
12962
13029
  "review.reload": (state) => state,
@@ -12976,6 +13043,11 @@ var init_reduce = __esmMin((() => {
12976
13043
  ...state,
12977
13044
  hideReviewed: !state.hideReviewed
12978
13045
  }),
13046
+ "panel.winnow": (state) => ({
13047
+ ...state,
13048
+ hideSettled: !state.hideSettled,
13049
+ panelIndex: 0
13050
+ }),
12979
13051
  "rail.toggle": toggleRail,
12980
13052
  "file.vouch": (state) => state,
12981
13053
  "file.vouch.next": (state) => state,
@@ -13406,6 +13478,7 @@ var init_theme = __esmMin((() => {
13406
13478
  "punctuation.bracket": { fg: inkFaint },
13407
13479
  "punctuation.delimiter": { fg: inkFaint },
13408
13480
  gap: { fg: inkFaint },
13481
+ picked: { bg: "#2b3854" },
13409
13482
  note: {
13410
13483
  fg: "#9aa7c7",
13411
13484
  italic: true
@@ -13421,7 +13494,7 @@ var init_theme = __esmMin((() => {
13421
13494
  }));
13422
13495
  //#endregion
13423
13496
  //#region src/tui/diffview.ts
13424
- var WASH, NOTE_MIN, ANSWER_MARK, OVERSCAN, SIGN_WIDTH, SCROLL_ROWS, PAN_COLUMNS, WAYS, notchesIn, wheelTo, SIGNS, numberFor, DiffView, startsOf, bareOf, keyOf, groupOf, isChrome, heldAt, sameLine, NO_SPANS, lineStarts, overLine, shifted, acrossLines, spansByLine, textAt, noteSpans, NOTE_PAINT, wrap, headOf, spokenLines, answerLines, noteLines, noteRows, proseRows, proseAt, notesAt, codeRow, rowsFor, layout, lineNumbers, BARE_SIGN, signFor, lineSigns, sideLineOf;
13497
+ var WASH, NOTE_MIN, ANSWER_MARK, OVERSCAN, SIGN_WIDTH, SCROLL_ROWS, PAN_COLUMNS, WAYS, notchesIn, takenOver, wheelTo, SIGNS, numberFor, DiffView, startsOf, bareOf, keyOf, groupOf, isChrome, alike, heldAt, sameLine, NO_SPANS, lineStarts, overLine, shifted, acrossLines, spansByLine, textAt, noteSpans, NOTE_PAINT, wrap, headOf, spokenLines, answerLines, noteLines, noteRows, proseRows, proseAt, notesAt, codeRow, rowsFor, layout, lineNumbers, BARE_SIGN, signFor, lineSigns, sideLineOf;
13425
13498
  var init_diffview = __esmMin((() => {
13426
13499
  init_dist();
13427
13500
  init_patch();
@@ -13462,9 +13535,14 @@ var init_diffview = __esmMin((() => {
13462
13535
  }
13463
13536
  };
13464
13537
  notchesIn = (event) => Math.max(1, event.scroll?.delta ?? 1);
13538
+ takenOver = (event) => {
13539
+ event.preventDefault?.();
13540
+ event.stopPropagation?.();
13541
+ };
13465
13542
  wheelTo = (event, handlers) => {
13466
13543
  const way = WAYS[event.scroll?.direction ?? ""];
13467
13544
  if (way === void 0) return;
13545
+ takenOver(event);
13468
13546
  const step = way.step * notchesIn(event);
13469
13547
  if (way.across || event.modifiers?.shift === true) handlers.pan(step * PAN_COLUMNS);
13470
13548
  else handlers.scroll(step * SCROLL_ROWS);
@@ -13503,6 +13581,7 @@ var init_diffview = __esmMin((() => {
13503
13581
  fitted = 1;
13504
13582
  wrapped = false;
13505
13583
  held = 0;
13584
+ picked;
13506
13585
  constructor(renderer) {
13507
13586
  this.code = new CodeRenderable(renderer, {
13508
13587
  id: "diff-code",
@@ -13581,12 +13660,12 @@ var init_diffview = __esmMin((() => {
13581
13660
  return this.numbers;
13582
13661
  }
13583
13662
  listenTo(handlers) {
13584
- this.numbers.onMouseScroll = (event) => wheelTo(event, handlers);
13585
13663
  for (const target of [this.numbers, this.code]) {
13586
- target.onMouseDown = (event) => handlers.down(event.y);
13587
- target.onMouseDrag = (event) => handlers.drag(event.y);
13588
- target.onMouseDragEnd = (event) => handlers.dragEnd(event.y);
13589
- target.onMouseUp = (event) => handlers.dragEnd(event.y);
13664
+ target.onMouseScroll = (event) => wheelTo(event, handlers);
13665
+ target.onMouseDown = (event) => handlers.down(event.y, event.x);
13666
+ target.onMouseDrag = (event) => handlers.drag(event.y, event.x);
13667
+ target.onMouseDragEnd = (event) => handlers.dragEnd(event.y, event.x);
13668
+ target.onMouseUp = (event) => handlers.dragEnd(event.y, event.x);
13590
13669
  }
13591
13670
  }
13592
13671
  refresh() {
@@ -13677,8 +13756,27 @@ var init_diffview = __esmMin((() => {
13677
13756
  hidden() {
13678
13757
  return Math.max(0, this.code.x - this.numbers.x) + SIGN_WIDTH;
13679
13758
  }
13759
+ pickedSpans() {
13760
+ const picked = this.picked;
13761
+ if (picked === void 0) return NO_SPANS;
13762
+ let at = 0;
13763
+ for (const entry of this.display) {
13764
+ const width = heldAt(entry, this.held).length;
13765
+ if (entry.row === picked.row && entry.stop === 0 && !isChrome(entry)) {
13766
+ const from = Math.min(picked.from, width);
13767
+ const to = Math.min(picked.to, width);
13768
+ return from >= to ? NO_SPANS : [[
13769
+ at + from,
13770
+ at + to,
13771
+ "picked"
13772
+ ]];
13773
+ }
13774
+ at += width + 1;
13775
+ }
13776
+ return NO_SPANS;
13777
+ }
13680
13778
  feed() {
13681
- const spans = noteSpans(this.display, this.held);
13779
+ const spans = [...noteSpans(this.display, this.held), ...this.pickedSpans()];
13682
13780
  this.code.content = textAt(this.display, this.held, this.hidden());
13683
13781
  this.code.onHighlight = (highlights) => {
13684
13782
  return [...(this.ownSpans() ?? highlights).filter((highlight) => !spans.some(([from, to]) => highlight[0] < to && highlight[1] > from)), ...spans];
@@ -13778,6 +13876,15 @@ var init_diffview = __esmMin((() => {
13778
13876
  screenRowOf(row) {
13779
13877
  return this.visualOfRow(row);
13780
13878
  }
13879
+ pick(picked) {
13880
+ if (alike(this.picked, picked)) return;
13881
+ this.picked = picked;
13882
+ this.feed();
13883
+ this.code.requestRender();
13884
+ }
13885
+ columnAt(x) {
13886
+ return Math.max(0, x - this.code.x + this.held);
13887
+ }
13781
13888
  blockAt(row, stop) {
13782
13889
  const first = this.display.findIndex((entry) => entry.row === row && entry.stop === stop);
13783
13890
  if (first === -1) return {
@@ -13840,6 +13947,7 @@ var init_diffview = __esmMin((() => {
13840
13947
  return entry.sent ? "note.sent" : "note";
13841
13948
  };
13842
13949
  isChrome = (entry) => entry.comment || entry.gap || entry.prose;
13950
+ alike = (left, right) => left === right || left !== void 0 && right !== void 0 && left.row === right.row && left.from === right.from && left.to === right.to;
13843
13951
  heldAt = (entry, pan) => isChrome(entry) && pan > 0 ? `${" ".repeat(pan)}${entry.text}` : entry.text;
13844
13952
  sameLine = (source, row) => source !== void 0 && source.trimEnd() === row.trimEnd();
13845
13953
  NO_SPANS = [];
@@ -14718,19 +14826,22 @@ var init_render = __esmMin((() => {
14718
14826
  this.wheelOnRail(this.listPane);
14719
14827
  this.wheelOnRail(this.list);
14720
14828
  this.view.listenTo({
14721
- scroll: (delta) => this.mouse?.onScroll(delta),
14829
+ scroll: (delta) => {
14830
+ this.dragFrom = void 0;
14831
+ this.mouse?.onScroll(delta);
14832
+ },
14722
14833
  pan: (delta) => this.mouse?.onPan(delta),
14723
- down: (y) => {
14724
- this.dragFrom = this.rowAtY(y);
14834
+ down: (y, x) => {
14835
+ this.dragFrom = this.spotAt(y, x);
14725
14836
  this.mouse?.onDrag(this.dragFrom, this.dragFrom, false);
14726
14837
  },
14727
- drag: (y) => {
14838
+ drag: (y, x) => {
14728
14839
  if (this.dragFrom === void 0) return;
14729
- this.mouse?.onDrag(this.dragFrom, this.rowAtY(y), false);
14840
+ this.mouse?.onDrag(this.dragFrom, this.spotAt(y, x), false);
14730
14841
  },
14731
- dragEnd: (y) => {
14842
+ dragEnd: (y, x) => {
14732
14843
  if (this.dragFrom === void 0) return;
14733
- this.mouse?.onDrag(this.dragFrom, this.rowAtY(y), true);
14844
+ this.mouse?.onDrag(this.dragFrom, this.spotAt(y, x), true);
14734
14845
  this.dragFrom = void 0;
14735
14846
  }
14736
14847
  });
@@ -14738,6 +14849,12 @@ var init_render = __esmMin((() => {
14738
14849
  rowAtY(y) {
14739
14850
  return this.view.rowAt(Math.max(0, y - this.view.screenTop() + this.lastTop));
14740
14851
  }
14852
+ spotAt(y, x) {
14853
+ return {
14854
+ row: this.rowAtY(y),
14855
+ column: this.view.columnAt(x)
14856
+ };
14857
+ }
14741
14858
  viewportRows() {
14742
14859
  const edges = this.diffPane.border === true ? PANE_EDGES : 0;
14743
14860
  const pane = this.diffPane.height - edges - STICKY_MAX;
@@ -14925,13 +15042,16 @@ var init_render = __esmMin((() => {
14925
15042
  this.view.setWrap(state.wrap);
14926
15043
  this.view.setPan(state.pan);
14927
15044
  this.view.show(patch, notesFor(state, patch.path), gapRowSet(shown), proseFor(state, patch.path));
14928
- this.view.fit(this.diffRows());
14929
- const height = this.view.rows();
14930
- const top = this.view.scrollTo(state.top, state.cursor, state.scroll);
14931
- this.lastTop = top;
14932
- this.paintSticky(state, this.view.rowAt(top));
14933
- this.view.paint(this.linePaint(state), top, height);
14934
- this.paintGutter(state, top, height);
15045
+ this.view.pick(state.picked);
15046
+ if (!takesText(state.screen)) {
15047
+ this.view.fit(this.diffRows());
15048
+ this.lastTop = this.view.scrollTo(state.top, state.cursor, state.scroll);
15049
+ if (state.sticky) this.paintSticky(state, this.view.rowAt(this.lastTop));
15050
+ else this.view.pin([]);
15051
+ }
15052
+ const top = this.lastTop;
15053
+ this.view.paint(this.linePaint(state), top, this.view.rows());
15054
+ this.paintGutter(state, top, this.view.rows());
14935
15055
  }
14936
15056
  assemble(renderer) {
14937
15057
  this.diffScroll.add(this.view.node());
@@ -15404,6 +15524,7 @@ var init_app = __esmMin((() => {
15404
15524
  sessionPath;
15405
15525
  remembered = "";
15406
15526
  wrapKept = false;
15527
+ stickyKept = true;
15407
15528
  keys = [];
15408
15529
  trail = [];
15409
15530
  began = Date.now();
@@ -15418,6 +15539,7 @@ var init_app = __esmMin((() => {
15418
15539
  this.noticeMs = options.noticeMs ?? 2200;
15419
15540
  this.sessionPath = options.sessionPath;
15420
15541
  this.wrapKept = options.wrap === true;
15542
+ this.stickyKept = options.sticky !== false;
15421
15543
  this.held = options.state;
15422
15544
  this.display = options.display;
15423
15545
  this.painting = options.painting;
@@ -15430,6 +15552,7 @@ var init_app = __esmMin((() => {
15430
15552
  onChip: (key) => this.dispatchTask(this.onKey(asKey(key))),
15431
15553
  onRail: (delta) => this.dispatchTask(this.rolled(delta))
15432
15554
  }));
15555
+ renderer.on("selection", () => this.copyDragged());
15433
15556
  renderer.keyInput.on("keypress", (key) => this.dispatch(key));
15434
15557
  renderer.keyInput.on("paste", (event) => this.dispatchPaste(event));
15435
15558
  renderer.on("destroy", () => this.stopWatching());
@@ -15511,6 +15634,11 @@ var init_app = __esmMin((() => {
15511
15634
  this.wrapKept = next.wrap;
15512
15635
  this.dispatchTask(asVoid(saveWrap(next.wrap)));
15513
15636
  }
15637
+ rememberSticky(next) {
15638
+ if (next.sticky === this.stickyKept) return;
15639
+ this.stickyKept = next.sticky;
15640
+ this.dispatchTask(asVoid(saveSticky(next.sticky)));
15641
+ }
15514
15642
  rememberPlace(next) {
15515
15643
  if (this.sessionPath === void 0 || next.screen !== "review") return;
15516
15644
  const session = sessionOf(next);
@@ -15632,6 +15760,7 @@ var init_app = __esmMin((() => {
15632
15760
  if (appeared) this.recordNotice(next.notice);
15633
15761
  this.rememberPlace(next);
15634
15762
  this.rememberWrap(next);
15763
+ this.rememberSticky(next);
15635
15764
  this.write(next);
15636
15765
  if (appeared) this.fade();
15637
15766
  }
@@ -15730,7 +15859,7 @@ var init_app = __esmMin((() => {
15730
15859
  }
15731
15860
  onKey(key, forced) {
15732
15861
  return gen({ self: this }, function* () {
15733
- const action = forced ?? actionFor(this.state.screen, keyName(key));
15862
+ const action = forced ?? actionFor(this.state.screen, keyName(key), this.state.focus);
15734
15863
  this.remember(action, key);
15735
15864
  if (action === void 0) {
15736
15865
  this.onText(key);
@@ -15803,8 +15932,18 @@ var init_app = __esmMin((() => {
15803
15932
  });
15804
15933
  }
15805
15934
  dragged(from, to, done) {
15806
- this.commit(draggedTo(this.measured(), from, to));
15807
- if (done && from !== to) this.copySelection(true);
15935
+ const along = from.row === to.row && from.column !== to.column;
15936
+ const held = this.measured();
15937
+ this.commit(along ? pickedIn(held, from.row, from.column, to.column) : draggedTo(held, from.row, to.row));
15938
+ if (done && (along || from.row !== to.row)) this.copySelection(true);
15939
+ }
15940
+ copyDragged() {
15941
+ const taken = this.renderer.getSelection()?.getSelectedText() ?? "";
15942
+ if (taken.trim().length === 0) return;
15943
+ copyToClipboard(taken);
15944
+ const lines = taken.split("\n").length;
15945
+ const said = lines === 1 ? `${taken.length} characters copied` : `${lines} lines copied`;
15946
+ this.commit(withNoticeHere(this.state, said));
15808
15947
  }
15809
15948
  copySelection(keep) {
15810
15949
  const said = keep ? withNoticeHere : withNotice;
@@ -15814,6 +15953,12 @@ var init_app = __esmMin((() => {
15814
15953
  this.commit(said(this.state, "comment copied"));
15815
15954
  return;
15816
15955
  }
15956
+ const taken = pickedText(this.state);
15957
+ if (taken !== void 0) {
15958
+ copyToClipboard(taken);
15959
+ this.commit(said(this.state, `${taken.length} characters copied`));
15960
+ return;
15961
+ }
15817
15962
  const lines = this.state.selecting ? selectedLines(this.state) : lineUnder(this.state);
15818
15963
  if (lines.length === 0) {
15819
15964
  this.commit(withNoticeHere(this.state, "nothing to copy"));
@@ -15944,9 +16089,17 @@ var init_app = __esmMin((() => {
15944
16089
  ...this.state,
15945
16090
  opened: this.state.opened.filter((was) => was !== id)
15946
16091
  }, sent);
15947
- this.commit(withNotice(held, "settled"));
16092
+ this.commit(withNotice(this.staying(held, id), "settled"));
15948
16093
  });
15949
16094
  }
16095
+ staying(state, id) {
16096
+ const at = panelIndexOf(state, id);
16097
+ const last = Math.max(0, panelEntries(state).length - 1);
16098
+ return {
16099
+ ...state,
16100
+ panelIndex: Math.min(at, last)
16101
+ };
16102
+ }
15950
16103
  removeHere() {
15951
16104
  return gen({ self: this }, function* () {
15952
16105
  const branch = selectedBranch(this.state);
@@ -16209,6 +16362,7 @@ var init_app = __esmMin((() => {
16209
16362
  };
16210
16363
  turnedOver = (state) => ({
16211
16364
  ...state,
16365
+ picked: void 0,
16212
16366
  railScroll: -1,
16213
16367
  scroll: -1,
16214
16368
  selecting: false,
@@ -16232,12 +16386,15 @@ var init_app = __esmMin((() => {
16232
16386
  const asOpened = openingOn(branches, options.branch);
16233
16387
  const resume = isSome(asOpened) ? asOpened : sessionPath === void 0 ? none() : yield* readSession(sessionPath);
16234
16388
  const store = yield* Store;
16235
- const wrap = (yield* store.settings).wrap === true;
16389
+ const settings = yield* store.settings;
16390
+ const wrap = settings.wrap === true;
16391
+ const sticky = settings.sticky !== false;
16236
16392
  const display = yield* Display.pipe(provide(displayOn(renderer, repo)));
16237
16393
  const waiting = yield* upgradeHint;
16238
16394
  const state = yield* make({
16239
16395
  ...initialState(branches),
16240
16396
  wrap,
16397
+ sticky,
16241
16398
  waiting
16242
16399
  });
16243
16400
  const painting = yield* forkDetach(runForEach(changes(state), display.paint));
@@ -16252,6 +16409,7 @@ var init_app = __esmMin((() => {
16252
16409
  sessionPath,
16253
16410
  resume: getOrUndefined$1(resume),
16254
16411
  wrap,
16412
+ sticky,
16255
16413
  intents
16256
16414
  });
16257
16415
  app.watch(yield* forkDetach(app.consume()));
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.70",
26
+ "version": "0.1.0-alpha.72",
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": {