@eliya-oss/agent-diff 0.1.0-alpha.71 → 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ## 0.1.0-alpha.71
4
10
 
5
11
  ### 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.71";
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();
@@ -11398,6 +11409,7 @@ var init_model = __esmMin((() => {
11398
11409
  reportFull: true,
11399
11410
  hideReviewed: false,
11400
11411
  hideSettled: false,
11412
+ picked: void 0,
11401
11413
  newestFirst: true,
11402
11414
  tallest: 0,
11403
11415
  scroll: -1,
@@ -11436,6 +11448,7 @@ var init_model = __esmMin((() => {
11436
11448
  focus: "diff",
11437
11449
  navOpen: true,
11438
11450
  wrap: false,
11451
+ sticky: true,
11439
11452
  pan: 0,
11440
11453
  layers: [],
11441
11454
  layersStale: false,
@@ -11675,6 +11688,15 @@ var init_model = __esmMin((() => {
11675
11688
  });
11676
11689
  return span === "" ? `Comment on ${patch.path}` : `Comment on ${patch.path}:${span}`;
11677
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
+ };
11678
11700
  selectedLines = (state) => {
11679
11701
  const patch = selectedPatch(state);
11680
11702
  if (patch === void 0) return [];
@@ -11834,6 +11856,11 @@ var init_model = __esmMin((() => {
11834
11856
  };
11835
11857
  return [...ordered("with"), ...ordered("answered")];
11836
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
+ };
11837
11864
  panelEntry = (state) => panelEntries(state)[state.panelIndex];
11838
11865
  threadChosen = (state) => {
11839
11866
  if (state.focus !== "review") return void 0;
@@ -12242,6 +12269,14 @@ var init_command = __esmMin((() => {
12242
12269
  keys: ["o"],
12243
12270
  screens: ["review"]
12244
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
+ }),
12245
12280
  command({
12246
12281
  action: "wrap.toggle",
12247
12282
  title: "Wrap long lines",
@@ -12582,7 +12617,7 @@ var init_match = __esmMin((() => {
12582
12617
  }));
12583
12618
  //#endregion
12584
12619
  //#region src/tui/reduce.ts
12585
- 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;
12586
12621
  var init_reduce = __esmMin((() => {
12587
12622
  init_dist();
12588
12623
  init_patch();
@@ -12593,7 +12628,11 @@ var init_reduce = __esmMin((() => {
12593
12628
  clamp = (value, low, high) => Math.max(low, Math.min(high, value));
12594
12629
  lastRow = (patch) => Math.max(0, (patch?.rows.length ?? 1) - 1);
12595
12630
  rowsIn = (state) => selectedPatch(state)?.rows.length ?? 0;
12596
- withCursorVisible = (state) => {
12631
+ withCursorVisible = (given) => {
12632
+ const state = given.picked === void 0 ? given : {
12633
+ ...given,
12634
+ picked: void 0
12635
+ };
12597
12636
  const height = Math.max(1, state.viewport);
12598
12637
  const highest = Math.max(0, rowsIn(state) - height);
12599
12638
  const top = state.cursor < state.top ? state.cursor : state.cursor >= state.top + height ? state.cursor - height + 1 : state.top;
@@ -12641,10 +12680,22 @@ var init_reduce = __esmMin((() => {
12641
12680
  };
12642
12681
  draggedTo = (state, from, to) => ({
12643
12682
  ...state,
12683
+ picked: void 0,
12644
12684
  selecting: true,
12645
12685
  anchorRow: clamp(from, 0, lastRow(selectedPatch(state))),
12646
12686
  cursor: clamp(to, 0, lastRow(selectedPatch(state)))
12647
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
+ });
12648
12699
  atRow = (state, row) => withCursorVisible({
12649
12700
  ...state,
12650
12701
  stop: 0,
@@ -12969,6 +13020,10 @@ var init_reduce = __esmMin((() => {
12969
13020
  wrap: !state.wrap,
12970
13021
  pan: 0
12971
13022
  }),
13023
+ "sticky.toggle": (state) => ({
13024
+ ...state,
13025
+ sticky: !state.sticky
13026
+ }),
12972
13027
  "pan.right": (state) => panned(state, PAN_STEP),
12973
13028
  "pan.left": (state) => panned(state, -8),
12974
13029
  "review.reload": (state) => state,
@@ -13423,6 +13478,7 @@ var init_theme = __esmMin((() => {
13423
13478
  "punctuation.bracket": { fg: inkFaint },
13424
13479
  "punctuation.delimiter": { fg: inkFaint },
13425
13480
  gap: { fg: inkFaint },
13481
+ picked: { bg: "#2b3854" },
13426
13482
  note: {
13427
13483
  fg: "#9aa7c7",
13428
13484
  italic: true
@@ -13438,7 +13494,7 @@ var init_theme = __esmMin((() => {
13438
13494
  }));
13439
13495
  //#endregion
13440
13496
  //#region src/tui/diffview.ts
13441
- 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;
13442
13498
  var init_diffview = __esmMin((() => {
13443
13499
  init_dist();
13444
13500
  init_patch();
@@ -13479,9 +13535,14 @@ var init_diffview = __esmMin((() => {
13479
13535
  }
13480
13536
  };
13481
13537
  notchesIn = (event) => Math.max(1, event.scroll?.delta ?? 1);
13538
+ takenOver = (event) => {
13539
+ event.preventDefault?.();
13540
+ event.stopPropagation?.();
13541
+ };
13482
13542
  wheelTo = (event, handlers) => {
13483
13543
  const way = WAYS[event.scroll?.direction ?? ""];
13484
13544
  if (way === void 0) return;
13545
+ takenOver(event);
13485
13546
  const step = way.step * notchesIn(event);
13486
13547
  if (way.across || event.modifiers?.shift === true) handlers.pan(step * PAN_COLUMNS);
13487
13548
  else handlers.scroll(step * SCROLL_ROWS);
@@ -13520,6 +13581,7 @@ var init_diffview = __esmMin((() => {
13520
13581
  fitted = 1;
13521
13582
  wrapped = false;
13522
13583
  held = 0;
13584
+ picked;
13523
13585
  constructor(renderer) {
13524
13586
  this.code = new CodeRenderable(renderer, {
13525
13587
  id: "diff-code",
@@ -13598,12 +13660,12 @@ var init_diffview = __esmMin((() => {
13598
13660
  return this.numbers;
13599
13661
  }
13600
13662
  listenTo(handlers) {
13601
- this.numbers.onMouseScroll = (event) => wheelTo(event, handlers);
13602
13663
  for (const target of [this.numbers, this.code]) {
13603
- target.onMouseDown = (event) => handlers.down(event.y);
13604
- target.onMouseDrag = (event) => handlers.drag(event.y);
13605
- target.onMouseDragEnd = (event) => handlers.dragEnd(event.y);
13606
- 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);
13607
13669
  }
13608
13670
  }
13609
13671
  refresh() {
@@ -13694,8 +13756,27 @@ var init_diffview = __esmMin((() => {
13694
13756
  hidden() {
13695
13757
  return Math.max(0, this.code.x - this.numbers.x) + SIGN_WIDTH;
13696
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
+ }
13697
13778
  feed() {
13698
- const spans = noteSpans(this.display, this.held);
13779
+ const spans = [...noteSpans(this.display, this.held), ...this.pickedSpans()];
13699
13780
  this.code.content = textAt(this.display, this.held, this.hidden());
13700
13781
  this.code.onHighlight = (highlights) => {
13701
13782
  return [...(this.ownSpans() ?? highlights).filter((highlight) => !spans.some(([from, to]) => highlight[0] < to && highlight[1] > from)), ...spans];
@@ -13795,6 +13876,15 @@ var init_diffview = __esmMin((() => {
13795
13876
  screenRowOf(row) {
13796
13877
  return this.visualOfRow(row);
13797
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
+ }
13798
13888
  blockAt(row, stop) {
13799
13889
  const first = this.display.findIndex((entry) => entry.row === row && entry.stop === stop);
13800
13890
  if (first === -1) return {
@@ -13857,6 +13947,7 @@ var init_diffview = __esmMin((() => {
13857
13947
  return entry.sent ? "note.sent" : "note";
13858
13948
  };
13859
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;
13860
13951
  heldAt = (entry, pan) => isChrome(entry) && pan > 0 ? `${" ".repeat(pan)}${entry.text}` : entry.text;
13861
13952
  sameLine = (source, row) => source !== void 0 && source.trimEnd() === row.trimEnd();
13862
13953
  NO_SPANS = [];
@@ -14735,19 +14826,22 @@ var init_render = __esmMin((() => {
14735
14826
  this.wheelOnRail(this.listPane);
14736
14827
  this.wheelOnRail(this.list);
14737
14828
  this.view.listenTo({
14738
- scroll: (delta) => this.mouse?.onScroll(delta),
14829
+ scroll: (delta) => {
14830
+ this.dragFrom = void 0;
14831
+ this.mouse?.onScroll(delta);
14832
+ },
14739
14833
  pan: (delta) => this.mouse?.onPan(delta),
14740
- down: (y) => {
14741
- this.dragFrom = this.rowAtY(y);
14834
+ down: (y, x) => {
14835
+ this.dragFrom = this.spotAt(y, x);
14742
14836
  this.mouse?.onDrag(this.dragFrom, this.dragFrom, false);
14743
14837
  },
14744
- drag: (y) => {
14838
+ drag: (y, x) => {
14745
14839
  if (this.dragFrom === void 0) return;
14746
- this.mouse?.onDrag(this.dragFrom, this.rowAtY(y), false);
14840
+ this.mouse?.onDrag(this.dragFrom, this.spotAt(y, x), false);
14747
14841
  },
14748
- dragEnd: (y) => {
14842
+ dragEnd: (y, x) => {
14749
14843
  if (this.dragFrom === void 0) return;
14750
- this.mouse?.onDrag(this.dragFrom, this.rowAtY(y), true);
14844
+ this.mouse?.onDrag(this.dragFrom, this.spotAt(y, x), true);
14751
14845
  this.dragFrom = void 0;
14752
14846
  }
14753
14847
  });
@@ -14755,6 +14849,12 @@ var init_render = __esmMin((() => {
14755
14849
  rowAtY(y) {
14756
14850
  return this.view.rowAt(Math.max(0, y - this.view.screenTop() + this.lastTop));
14757
14851
  }
14852
+ spotAt(y, x) {
14853
+ return {
14854
+ row: this.rowAtY(y),
14855
+ column: this.view.columnAt(x)
14856
+ };
14857
+ }
14758
14858
  viewportRows() {
14759
14859
  const edges = this.diffPane.border === true ? PANE_EDGES : 0;
14760
14860
  const pane = this.diffPane.height - edges - STICKY_MAX;
@@ -14942,13 +15042,16 @@ var init_render = __esmMin((() => {
14942
15042
  this.view.setWrap(state.wrap);
14943
15043
  this.view.setPan(state.pan);
14944
15044
  this.view.show(patch, notesFor(state, patch.path), gapRowSet(shown), proseFor(state, patch.path));
14945
- this.view.fit(this.diffRows());
14946
- const height = this.view.rows();
14947
- const top = this.view.scrollTo(state.top, state.cursor, state.scroll);
14948
- this.lastTop = top;
14949
- this.paintSticky(state, this.view.rowAt(top));
14950
- this.view.paint(this.linePaint(state), top, height);
14951
- 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());
14952
15055
  }
14953
15056
  assemble(renderer) {
14954
15057
  this.diffScroll.add(this.view.node());
@@ -15421,6 +15524,7 @@ var init_app = __esmMin((() => {
15421
15524
  sessionPath;
15422
15525
  remembered = "";
15423
15526
  wrapKept = false;
15527
+ stickyKept = true;
15424
15528
  keys = [];
15425
15529
  trail = [];
15426
15530
  began = Date.now();
@@ -15435,6 +15539,7 @@ var init_app = __esmMin((() => {
15435
15539
  this.noticeMs = options.noticeMs ?? 2200;
15436
15540
  this.sessionPath = options.sessionPath;
15437
15541
  this.wrapKept = options.wrap === true;
15542
+ this.stickyKept = options.sticky !== false;
15438
15543
  this.held = options.state;
15439
15544
  this.display = options.display;
15440
15545
  this.painting = options.painting;
@@ -15447,6 +15552,7 @@ var init_app = __esmMin((() => {
15447
15552
  onChip: (key) => this.dispatchTask(this.onKey(asKey(key))),
15448
15553
  onRail: (delta) => this.dispatchTask(this.rolled(delta))
15449
15554
  }));
15555
+ renderer.on("selection", () => this.copyDragged());
15450
15556
  renderer.keyInput.on("keypress", (key) => this.dispatch(key));
15451
15557
  renderer.keyInput.on("paste", (event) => this.dispatchPaste(event));
15452
15558
  renderer.on("destroy", () => this.stopWatching());
@@ -15528,6 +15634,11 @@ var init_app = __esmMin((() => {
15528
15634
  this.wrapKept = next.wrap;
15529
15635
  this.dispatchTask(asVoid(saveWrap(next.wrap)));
15530
15636
  }
15637
+ rememberSticky(next) {
15638
+ if (next.sticky === this.stickyKept) return;
15639
+ this.stickyKept = next.sticky;
15640
+ this.dispatchTask(asVoid(saveSticky(next.sticky)));
15641
+ }
15531
15642
  rememberPlace(next) {
15532
15643
  if (this.sessionPath === void 0 || next.screen !== "review") return;
15533
15644
  const session = sessionOf(next);
@@ -15649,6 +15760,7 @@ var init_app = __esmMin((() => {
15649
15760
  if (appeared) this.recordNotice(next.notice);
15650
15761
  this.rememberPlace(next);
15651
15762
  this.rememberWrap(next);
15763
+ this.rememberSticky(next);
15652
15764
  this.write(next);
15653
15765
  if (appeared) this.fade();
15654
15766
  }
@@ -15820,8 +15932,18 @@ var init_app = __esmMin((() => {
15820
15932
  });
15821
15933
  }
15822
15934
  dragged(from, to, done) {
15823
- this.commit(draggedTo(this.measured(), from, to));
15824
- 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));
15825
15947
  }
15826
15948
  copySelection(keep) {
15827
15949
  const said = keep ? withNoticeHere : withNotice;
@@ -15831,6 +15953,12 @@ var init_app = __esmMin((() => {
15831
15953
  this.commit(said(this.state, "comment copied"));
15832
15954
  return;
15833
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
+ }
15834
15962
  const lines = this.state.selecting ? selectedLines(this.state) : lineUnder(this.state);
15835
15963
  if (lines.length === 0) {
15836
15964
  this.commit(withNoticeHere(this.state, "nothing to copy"));
@@ -15961,9 +16089,17 @@ var init_app = __esmMin((() => {
15961
16089
  ...this.state,
15962
16090
  opened: this.state.opened.filter((was) => was !== id)
15963
16091
  }, sent);
15964
- this.commit(withNotice(held, "settled"));
16092
+ this.commit(withNotice(this.staying(held, id), "settled"));
15965
16093
  });
15966
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
+ }
15967
16103
  removeHere() {
15968
16104
  return gen({ self: this }, function* () {
15969
16105
  const branch = selectedBranch(this.state);
@@ -16226,6 +16362,7 @@ var init_app = __esmMin((() => {
16226
16362
  };
16227
16363
  turnedOver = (state) => ({
16228
16364
  ...state,
16365
+ picked: void 0,
16229
16366
  railScroll: -1,
16230
16367
  scroll: -1,
16231
16368
  selecting: false,
@@ -16249,12 +16386,15 @@ var init_app = __esmMin((() => {
16249
16386
  const asOpened = openingOn(branches, options.branch);
16250
16387
  const resume = isSome(asOpened) ? asOpened : sessionPath === void 0 ? none() : yield* readSession(sessionPath);
16251
16388
  const store = yield* Store;
16252
- 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;
16253
16392
  const display = yield* Display.pipe(provide(displayOn(renderer, repo)));
16254
16393
  const waiting = yield* upgradeHint;
16255
16394
  const state = yield* make({
16256
16395
  ...initialState(branches),
16257
16396
  wrap,
16397
+ sticky,
16258
16398
  waiting
16259
16399
  });
16260
16400
  const painting = yield* forkDetach(runForEach(changes(state), display.paint));
@@ -16269,6 +16409,7 @@ var init_app = __esmMin((() => {
16269
16409
  sessionPath,
16270
16410
  resume: getOrUndefined$1(resume),
16271
16411
  wrap,
16412
+ sticky,
16272
16413
  intents
16273
16414
  });
16274
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.71",
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": {