@eliya-oss/agent-diff 0.1.0-alpha.102 → 0.1.0-alpha.103

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.103
4
+
5
+ ### Minor Changes
6
+
7
+ - Looking for something opens a box to type in, filled from the clipboard or from what the mouse picked, rather than guessing a name from the selected line. Matches are grouped under the file they are in, and the one under the cursor shows the lines around it.
8
+
3
9
  ## 0.1.0-alpha.102
4
10
 
5
11
  ### Patch Changes
package/dist/main.js CHANGED
@@ -3,7 +3,7 @@ import { appendFile, mkdir, readFile, realpath, rename, stat, writeFile } from "
3
3
  import { homedir, hostname, platform } from "node:os";
4
4
  import { text } from "node:stream/consumers";
5
5
  import { dirname, join, resolve } from "node:path";
6
- import { execFile, spawn } from "node:child_process";
6
+ import { execFile, spawn, spawnSync } from "node:child_process";
7
7
  import { promisify } from "node:util";
8
8
  import { existsSync, mkdirSync, readFileSync, realpathSync, watch } from "node:fs";
9
9
  import { fileURLToPath } from "node:url";
@@ -9926,7 +9926,7 @@ var init_pane = __esmMin((() => {
9926
9926
  init_commands();
9927
9927
  init_init();
9928
9928
  init_pane();
9929
- var version$1 = "0.1.0-alpha.102";
9929
+ var version$1 = "0.1.0-alpha.103";
9930
9930
  //#endregion
9931
9931
  //#region src/cli/upgrade.ts
9932
9932
  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;
@@ -11767,7 +11767,7 @@ var init_tree = __esmMin((() => {
11767
11767
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
11768
11768
  };
11769
11769
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
11770
- })), nothingReviewed, initialState, TREE_MAX, TREE_ROOMY, 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, brokenAt, laidLine, laidDraft, caretRow, caretColumn, caretOn, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, replyTarget, pickedText, selectedLines, KEYWORDS, NAME, longestName$1, searchTerm, shownMatches, matchHere, selectionReadout, WHOLE_FILE, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, answersIn, newerOf, spokeLast, sectionOf, sentEntry, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, layerFile, selectionRange;
11770
+ })), nothingReviewed, initialState, TREE_MAX, TREE_ROOMY, 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, brokenAt, laidLine, laidDraft, caretRow, caretColumn, caretOn, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, replyTarget, pickedText, selectedLines, shownMatches, matchHere, selectionReadout, WHOLE_FILE, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, answersIn, newerOf, spokeLast, sectionOf, sentEntry, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, layerFile, selectionRange;
11771
11771
  var init_model = __esmMin((() => {
11772
11772
  init_dist();
11773
11773
  init_patch();
@@ -12108,63 +12108,6 @@ var init_model = __esmMin((() => {
12108
12108
  const [from, to] = selectionRange(state);
12109
12109
  return patch.rows.slice(from, to + 1).map((row) => row.text);
12110
12110
  };
12111
- KEYWORDS = /* @__PURE__ */ new Set([
12112
- "const",
12113
- "let",
12114
- "var",
12115
- "function",
12116
- "return",
12117
- "export",
12118
- "import",
12119
- "from",
12120
- "type",
12121
- "interface",
12122
- "class",
12123
- "extends",
12124
- "implements",
12125
- "async",
12126
- "await",
12127
- "new",
12128
- "this",
12129
- "if",
12130
- "else",
12131
- "for",
12132
- "while",
12133
- "switch",
12134
- "case",
12135
- "default",
12136
- "break",
12137
- "continue",
12138
- "throw",
12139
- "try",
12140
- "catch",
12141
- "finally",
12142
- "typeof",
12143
- "readonly",
12144
- "public",
12145
- "private",
12146
- "static",
12147
- "true",
12148
- "false",
12149
- "null",
12150
- "undefined",
12151
- "void",
12152
- "string",
12153
- "number",
12154
- "boolean",
12155
- "any",
12156
- "unknown",
12157
- "never"
12158
- ]);
12159
- NAME = /[A-Za-z_$][\w$]*/g;
12160
- longestName$1 = (line) => [...line.matchAll(NAME)].map((found) => found[0]).filter((name) => !KEYWORDS.has(name)).toSorted((left, right) => right.length - left.length)[0];
12161
- searchTerm = (state) => {
12162
- const taken = pickedText(state)?.trim();
12163
- if (taken !== void 0 && taken.length > 0) return taken;
12164
- const line = selectedLines(state).map((text) => text.trim()).find((text) => text.length > 0);
12165
- if (line === void 0) return "";
12166
- return longestName$1(line) ?? line;
12167
- };
12168
12111
  shownMatches = (state) => {
12169
12112
  const wanted = state.query.trim().toLowerCase();
12170
12113
  if (wanted.length === 0) return state.matches;
@@ -13066,7 +13009,7 @@ var init_match = __esmMin((() => {
13066
13009
  }));
13067
13010
  //#endregion
13068
13011
  //#region src/tui/reduce.ts
13069
- 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, PANES, panesShown, focusStepped, togglePanel, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, landingOn, revealing, moveFile, selectHunk, swapEnds, atBranch, grownBy, startSelection, openCompose, goBack, walkMatches, openPalette, openKeys, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, resumedAt, atFile, withContext, withFull, revealsAfter, gapShown, gapOpened, panBy, withSent, withArrived, withColumns, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, openedAt, withPatches, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, withDraft, paletteMoved, paletteClosed, withWaiting, withMatches, withNoticeHere, withNotice;
13012
+ 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, PANES, panesShown, focusStepped, togglePanel, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, landingOn, revealing, moveFile, selectHunk, swapEnds, atBranch, grownBy, startSelection, openCompose, goBack, walkMatches, openPalette, openKeys, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, resumedAt, atFile, withContext, withFull, revealsAfter, gapShown, gapOpened, panBy, withSent, withArrived, withColumns, 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;
13070
13013
  var init_reduce = __esmMin((() => {
13071
13014
  init_dist();
13072
13015
  init_patch();
@@ -13780,13 +13723,21 @@ var init_reduce = __esmMin((() => {
13780
13723
  ...state,
13781
13724
  waiting
13782
13725
  });
13726
+ withFinder = (state, seed) => ({
13727
+ ...state,
13728
+ screen: "search",
13729
+ matches: [],
13730
+ matchIndex: 0,
13731
+ term: "",
13732
+ query: seed,
13733
+ selecting: false
13734
+ });
13783
13735
  withMatches = (state, matches, term) => ({
13784
13736
  ...state,
13785
13737
  screen: "search",
13786
13738
  matches,
13787
13739
  matchIndex: 0,
13788
13740
  term,
13789
- query: "",
13790
13741
  selecting: false
13791
13742
  });
13792
13743
  withNoticeHere = (state, notice) => ({
@@ -14608,7 +14559,7 @@ var init_diffview = __esmMin((() => {
14608
14559
  }));
14609
14560
  //#endregion
14610
14561
  //#region src/tui/render.ts
14611
- var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, SELECTION, CURSOR, ACCENT, GAP_PAINT, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, clip, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, SUMMARY_LINES, summaryLines, contextLabel, nameRoom, stateRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, placeLabel, headerParts, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, STEP_NUMBER, STEP_LEAD, NOTE_LEAD, STEP_GAP, STALE_ROOM, STALE_LONG, STALE_SHORT, staleBanner, layerRoom, layerFold, layerHead, layerText, layerPaint, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, restingOrHere, foundTitle, MATCH_SHARE, matchRow, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelText, Screen;
14562
+ var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, SELECTION, CURSOR, ACCENT, GAP_PAINT, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, clip, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, SUMMARY_LINES, summaryLines, contextLabel, nameRoom, stateRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, placeLabel, headerParts, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, STEP_NUMBER, STEP_LEAD, NOTE_LEAD, STEP_GAP, STALE_ROOM, STALE_LONG, STALE_SHORT, staleBanner, layerRoom, layerFold, layerHead, layerText, layerPaint, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, restingOrHere, foundTitle, fileRow, blockOf, aroundRow, windowedBlocks, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelText, Screen;
14612
14563
  var init_render = __esmMin((() => {
14613
14564
  init_command();
14614
14565
  init_patch();
@@ -15259,14 +15210,40 @@ var init_render = __esmMin((() => {
15259
15210
  const said = shown === all ? `${all} elsewhere` : `${shown} of ${all} elsewhere`;
15260
15211
  return `${state.term} · ${said}`;
15261
15212
  };
15262
- MATCH_SHARE = .45;
15263
- matchRow = (match, room) => {
15264
- const lead = match.changed ? marks().comment : " ";
15265
- const where = `:${match.line}`;
15266
- const said = match.text.trim();
15267
- const forPath = Math.max(8, Math.floor(room * MATCH_SHARE) - where.length);
15268
- const left = `${lead} ${clipHead(match.path, forPath)}${where}`;
15269
- return `${left} ${clip(said, Math.max(1, room - left.length - 2))}`;
15213
+ fileRow = (match, room) => {
15214
+ const said = ` ${match.changed ? marks().comment : " "} ${clipHead(match.path, Math.max(8, room - 3))}`;
15215
+ return {
15216
+ rows: 1,
15217
+ chunks: [fg(palette.accent)(said.padEnd(room)), fg(palette.faint)("\n")]
15218
+ };
15219
+ };
15220
+ blockOf = (match, room, here) => {
15221
+ const lit = (here ? match.around.map((line) => aroundRow(line, match.line, room)) : [fg(palette.muted)(` ${String(match.line).padStart(5)} ${clip(match.text.trim(), Math.max(1, room - 11))}`.padEnd(room))]).map((chunk) => here ? bg(palette.selection)(chunk) : chunk);
15222
+ return {
15223
+ rows: lit.length,
15224
+ chunks: lit.flatMap((chunk) => [chunk, fg(palette.faint)("\n")])
15225
+ };
15226
+ };
15227
+ aroundRow = (line, at, room) => {
15228
+ const numbered = /^\s*(\d+) ?(.*)$/.exec(line);
15229
+ const number = Number(numbered?.[1] ?? 0);
15230
+ const text = numbered?.[2] ?? line;
15231
+ const said = ` ${number === at ? "▸" : " "} ${String(number).padStart(5)} ${text}`;
15232
+ return fg(number === at ? palette.ink : palette.faint)(clip(said, room).padEnd(room));
15233
+ };
15234
+ windowedBlocks = (blocks, at, room) => {
15235
+ const kept = [];
15236
+ let rows = 0;
15237
+ for (const [index, block] of blocks.entries()) {
15238
+ if (index < at && rows + block.rows > room) continue;
15239
+ if (rows + block.rows > room && index > at) break;
15240
+ kept.push(block);
15241
+ rows += block.rows;
15242
+ }
15243
+ return {
15244
+ rows,
15245
+ chunks: kept.flatMap((block) => block.chunks)
15246
+ };
15270
15247
  };
15271
15248
  panelWhere = (entry, room) => {
15272
15249
  const where = `:${entry.comment.end}`;
@@ -15822,17 +15799,22 @@ var init_render = __esmMin((() => {
15822
15799
  return;
15823
15800
  }
15824
15801
  const room = panelWidth(this.renderer.width);
15825
- const here = matchHere(state);
15826
- this.foundTitle.content = foundTitle(state);
15827
- const peekHigh = here?.around.length ?? 0;
15828
- const foundRoom = Math.min(panelRows(this.renderer.height, PANEL_FIFTH), shownMatches(state).length + peekHigh + PALETTE_CHROME);
15829
15802
  const wide = Math.max(1, room - MODAL_ROOM);
15803
+ this.foundTitle.content = foundTitle(state);
15830
15804
  const shown = shownMatches(state);
15831
- this.foundChoices.content = listText(shown.map((match) => matchRow(match, wide)), state.matchIndex, Math.max(1, foundRoom - peekHigh - PALETTE_CHROME));
15832
- this.foundPeek.content = (here?.around ?? []).map((line) => clip(line, Math.max(1, room - MODAL_ROOM))).join("\n");
15833
- const peekRows = here?.around.length ?? 0;
15834
- this.foundPeek.height = peekRows;
15835
- this.found.height = Math.min(panelRows(this.renderer.height, PANEL_FIFTH), shownMatches(state).length + peekRows + PALETTE_CHROME);
15805
+ const most = panelRows(this.renderer.height, PANEL_FIFTH);
15806
+ const blocks = [];
15807
+ let chosen = 0;
15808
+ for (const [at, match] of shown.entries()) {
15809
+ if (shown[at - 1]?.path !== match.path) blocks.push(fileRow(match, wide));
15810
+ if (at === state.matchIndex) chosen = blocks.length;
15811
+ blocks.push(blockOf(match, wide, at === state.matchIndex));
15812
+ }
15813
+ const window = windowedBlocks(blocks, chosen, Math.max(3, most - PALETTE_CHROME));
15814
+ this.foundChoices.content = new StyledText([...window.chunks]);
15815
+ this.foundPeek.content = "";
15816
+ this.foundPeek.height = 0;
15817
+ this.found.height = Math.min(most, window.rows + PALETTE_CHROME);
15836
15818
  this.found.width = room;
15837
15819
  this.found.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room) / 2));
15838
15820
  this.found.top = panelTop(this.renderer.height, PANEL_FIFTH);
@@ -16057,7 +16039,7 @@ var init_upgrade = __esmMin((() => {
16057
16039
  return due ? `adiff ${latest} is out · adiff upgrade` : "";
16058
16040
  }).pipe(withSpan("Tui.upgradeHint"));
16059
16041
  upgradeHint = worded.pipe(orElseSucceed(() => ""));
16060
- })), LEAVING_SAID, NOTICE_MS, KEY_HISTORY, DRAIN_PASSES, TRAIL_HISTORY, clockOf, momentOf, noticeOf, COPIERS, wayland, handOver, throughMultiplexer, copyToClipboard, lineUnder, asKey, openedPull, LISTENS, WRITES, OVER, overReview, writesInto, listens, LETTER, laidOut, ARROWS, SHIFTED, keyName, App, turnedOver, settledPath, restsWhereItLanded, lonelyGaps, chosenIn, settingsHeld, firstBranches, missing, openingOn, launch, told, untilDestroyed, runOn, runTui;
16042
+ })), LEAVING_SAID, NOTICE_MS, KEY_HISTORY, DRAIN_PASSES, TRAIL_HISTORY, clockOf, momentOf, noticeOf, COPIERS, wayland, PASTERS, PASTE_MS, SEED_MOST, clipped, seedFor, handOver, throughMultiplexer, copyToClipboard, lineUnder, asKey, openedPull, LISTENS, WRITES, OVER, overReview, writesInto, listens, LETTER, laidOut, ARROWS, SHIFTED, keyName, App, turnedOver, settledPath, restsWhereItLanded, lonelyGaps, chosenIn, settingsHeld, firstBranches, missing, openingOn, launch, told, untilDestroyed, runOn, runTui;
16061
16043
  var init_app = __esmMin((() => {
16062
16044
  init_dist();
16063
16045
  init_report();
@@ -16100,6 +16082,33 @@ var init_app = __esmMin((() => {
16100
16082
  win32: ["clip"]
16101
16083
  };
16102
16084
  wayland = () => process.env["WAYLAND_DISPLAY"] === void 0 ? void 0 : ["wl-copy"];
16085
+ PASTERS = {
16086
+ darwin: ["pbpaste"],
16087
+ linux: [
16088
+ "xclip",
16089
+ "-selection",
16090
+ "clipboard",
16091
+ "-o"
16092
+ ]
16093
+ };
16094
+ PASTE_MS = 300;
16095
+ SEED_MOST = 120;
16096
+ clipped = () => {
16097
+ if (!process.stdout.isTTY) return "";
16098
+ const [command, ...rest] = (process.env["WAYLAND_DISPLAY"] === void 0 ? PASTERS[platform()] : ["wl-paste"]) ?? [];
16099
+ if (command === void 0) return "";
16100
+ const read = spawnSync(command, [...rest], {
16101
+ encoding: "utf8",
16102
+ timeout: PASTE_MS
16103
+ });
16104
+ return read.status === 0 ? read.stdout ?? "" : "";
16105
+ };
16106
+ seedFor = (picked) => {
16107
+ if (picked !== void 0 && picked.trim().length > 0) return picked.trim();
16108
+ const held = clipped().trim();
16109
+ const one = held.split("\n")[0] ?? "";
16110
+ return one.length > 0 && one.length <= SEED_MOST && one === held ? one : "";
16111
+ };
16103
16112
  handOver = (text) => {
16104
16113
  if (!process.stdout.isTTY) return;
16105
16114
  const named = wayland() ?? COPIERS[platform()];
@@ -16546,7 +16555,7 @@ var init_app = __esmMin((() => {
16546
16555
  "thread.reply": () => this.replyHere(),
16547
16556
  "selection.copy": () => sync(() => this.copySelection(false)),
16548
16557
  "search.open": () => this.findSelection(),
16549
- "search.jump": () => this.openMatch(),
16558
+ "search.jump": () => this.runFinder(),
16550
16559
  "review.reload": () => this.state.screen === "branches" ? this.reloadList() : this.reloadBranch(),
16551
16560
  "report.open": () => sync(() => this.commit(reduce(this.measured(), "report.open"))),
16552
16561
  back: () => this.goBack(),
@@ -16717,19 +16726,29 @@ var init_app = __esmMin((() => {
16717
16726
  this.commit(said(this.state, many));
16718
16727
  }
16719
16728
  findSelection() {
16729
+ return sync(() => {
16730
+ const seed = seedFor(pickedText(this.state));
16731
+ this.commit(withFinder(this.state, seed));
16732
+ runSync(this.display.askWith(seed));
16733
+ });
16734
+ }
16735
+ runFinder() {
16720
16736
  return gen({ self: this }, function* () {
16721
- const branch = selectedBranch(this.state);
16722
- const term = searchTerm(this.state);
16723
- if (branch === void 0 || term.length === 0) {
16724
- this.commit(withNoticeHere(this.state, "nothing selected"));
16725
- return;
16726
- }
16727
- const elsewhere = (yield* searchBranch(this.repo, branch.branch, term)).filter((match) => !this.isHere(match));
16728
- if (elsewhere.length === 0) {
16729
- this.commit(withNotice(this.state, `no other place uses ${term}`));
16737
+ const wanted = this.state.query.trim();
16738
+ if (wanted.length > 0 && wanted !== this.state.term) {
16739
+ yield* this.lookFor(wanted);
16730
16740
  return;
16731
16741
  }
16732
- this.commit(withMatches(this.state, elsewhere, term));
16742
+ yield* this.openMatch();
16743
+ });
16744
+ }
16745
+ lookFor(wanted) {
16746
+ return gen({ self: this }, function* () {
16747
+ const branch = selectedBranch(this.state);
16748
+ if (branch === void 0) return;
16749
+ const elsewhere = (yield* searchBranch(this.repo, branch.branch, wanted)).filter((match) => !this.isHere(match));
16750
+ this.commit(withMatches(this.state, elsewhere, wanted));
16751
+ if (elsewhere.length === 0) this.commit(withNoticeHere(this.state, `no other place uses ${wanted}`));
16733
16752
  });
16734
16753
  }
16735
16754
  isHere(match) {
@@ -17342,7 +17361,6 @@ var tui_exports = /* @__PURE__ */ __exportAll({
17342
17361
  runOn: () => runOn,
17343
17362
  runTui: () => runTui,
17344
17363
  searchCommands: () => searchCommands,
17345
- searchTerm: () => searchTerm,
17346
17364
  syntaxTheme: () => syntaxTheme,
17347
17365
  withPatches: () => withPatches
17348
17366
  });
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.102",
26
+ "version": "0.1.0-alpha.103",
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": {