@eliya-oss/agent-diff 0.1.0-alpha.73 → 0.1.0-alpha.74

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.74
4
+
5
+ ### Patch Changes
6
+
7
+ - The box a comment is written in behaves like one: the caret is the cell it stands on rather than a character shifting the words, and the arrows move a line at a time through the wrap. `shift` with an arrow grows the selection to comment on.
8
+
3
9
  ## 0.1.0-alpha.73
4
10
 
5
11
  ### Patch Changes
package/dist/main.js CHANGED
@@ -9661,7 +9661,7 @@ var init_pane = __esmMin((() => {
9661
9661
  init_commands();
9662
9662
  init_init();
9663
9663
  init_pane();
9664
- var version$1 = "0.1.0-alpha.73";
9664
+ var version$1 = "0.1.0-alpha.74";
9665
9665
  //#endregion
9666
9666
  //#region src/cli/upgrade.ts
9667
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;
@@ -11394,7 +11394,7 @@ var init_tree = __esmMin((() => {
11394
11394
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
11395
11395
  };
11396
11396
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
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;
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, brokenAt, laidLine, laidDraft, caretRow, caretColumn, caretOn, caretAt, WORD, wordLeft, wordRight, caretByWord, lineStart, lineEnd, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, caretByRow, 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;
11398
11398
  var init_model = __esmMin((() => {
11399
11399
  init_dist();
11400
11400
  init_patch();
@@ -11652,11 +11652,49 @@ var init_model = __esmMin((() => {
11652
11652
  onNone: () => "-",
11653
11653
  onSome: (line) => String(line)
11654
11654
  });
11655
- caretAt = (state) => Math.max(0, Math.min(state.draft.length, state.caret));
11656
- drafted = (state) => {
11657
- const at = caretAt(state);
11658
- return `${state.draft.slice(0, at)}▌${state.draft.slice(at)}`;
11655
+ brokenAt = (text, room) => {
11656
+ const space = text.lastIndexOf(" ", room);
11657
+ return space > 0 ? space + 1 : room;
11658
+ };
11659
+ laidLine = (line, from, room) => {
11660
+ const rows = [];
11661
+ let at = 0;
11662
+ while (line.length - at > room) {
11663
+ const width = brokenAt(line.slice(at), room);
11664
+ rows.push({
11665
+ text: line.slice(at, at + width),
11666
+ from: from + at
11667
+ });
11668
+ at += width;
11669
+ }
11670
+ rows.push({
11671
+ text: line.slice(at),
11672
+ from: from + at
11673
+ });
11674
+ return rows;
11675
+ };
11676
+ laidDraft = (draft, room) => {
11677
+ const width = Math.max(1, room);
11678
+ const rows = [];
11679
+ let from = 0;
11680
+ for (const line of draft.split("\n")) {
11681
+ rows.push(...laidLine(line, from, width));
11682
+ from += line.length + 1;
11683
+ }
11684
+ return rows;
11659
11685
  };
11686
+ caretRow = (rows, caret) => {
11687
+ const at = rows.findIndex((row) => caret >= row.from && caret <= row.from + row.text.length);
11688
+ return at === -1 ? Math.max(0, rows.length - 1) : at;
11689
+ };
11690
+ caretColumn = (rows, caret) => caret - (rows[caretRow(rows, caret)]?.from ?? 0);
11691
+ caretOn = (rows, row, column) => {
11692
+ const held = rows[Math.max(0, Math.min(rows.length - 1, row))];
11693
+ if (held === void 0) return 0;
11694
+ const last = held.text.endsWith(" ") ? held.text.length - 1 : held.text.length;
11695
+ return held.from + Math.min(column, Math.max(0, last));
11696
+ };
11697
+ caretAt = (state) => Math.max(0, Math.min(state.draft.length, state.caret));
11660
11698
  WORD = /[\p{L}\p{N}_]/u;
11661
11699
  wordLeft = (draft, from) => {
11662
11700
  let at = from;
@@ -11676,6 +11714,20 @@ var init_model = __esmMin((() => {
11676
11714
  const found = draft.indexOf("\n", at);
11677
11715
  return found === -1 ? draft.length : found;
11678
11716
  };
11717
+ COMPOSE_BOX = 72;
11718
+ COMPOSE_MARGIN = 4;
11719
+ COMPOSE_PAD = 5;
11720
+ COMPOSE_LEAST = 8;
11721
+ composeBox = (columns) => Math.max(0, Math.min(COMPOSE_BOX, columns - COMPOSE_MARGIN));
11722
+ composeRoom$1 = (columns) => Math.max(COMPOSE_LEAST, composeBox(columns) - COMPOSE_PAD);
11723
+ caretByRow = (state, delta) => {
11724
+ const rows = laidDraft(state.draft, composeRoom$1(state.columns));
11725
+ const at = caretAt(state);
11726
+ const wanted = caretRow(rows, at) + delta;
11727
+ if (wanted < 0) return 0;
11728
+ if (wanted >= rows.length) return state.draft.length;
11729
+ return caretOn(rows, wanted, caretColumn(rows, at));
11730
+ };
11679
11731
  caretToEdge = (state, edge) => edge === "start" ? lineStart(state.draft, caretAt(state)) : lineEnd(state.draft, caretAt(state));
11680
11732
  composeTarget = (state) => {
11681
11733
  const patch = selectedPatch(state);
@@ -12214,6 +12266,24 @@ var init_command = __esmMin((() => {
12214
12266
  keys: ["G"],
12215
12267
  screens: ["branches"]
12216
12268
  }),
12269
+ command({
12270
+ action: "select.grow",
12271
+ panes: ["diff"],
12272
+ title: "Take the line below into the selection",
12273
+ category: "Selecting",
12274
+ keys: ["shift+down"],
12275
+ screens: ["review"],
12276
+ listed: false
12277
+ }),
12278
+ command({
12279
+ action: "select.shrink",
12280
+ panes: ["diff"],
12281
+ title: "Take the line above into the selection",
12282
+ category: "Selecting",
12283
+ keys: ["shift+up"],
12284
+ screens: ["review"],
12285
+ listed: false
12286
+ }),
12217
12287
  command({
12218
12288
  action: "select.hunk",
12219
12289
  category: "Selecting",
@@ -12617,7 +12687,7 @@ var init_match = __esmMin((() => {
12617
12687
  }));
12618
12688
  //#endregion
12619
12689
  //#region src/tui/reduce.ts
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;
12690
+ 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, grownBy, 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, caretRowed, caretEnded, caretHomed, paletteMoved, paletteClosed, withWaiting, withMatches, withNoticeHere, withNotice;
12621
12691
  var init_reduce = __esmMin((() => {
12622
12692
  init_dist();
12623
12693
  init_patch();
@@ -12892,6 +12962,18 @@ var init_reduce = __esmMin((() => {
12892
12962
  ...state,
12893
12963
  branchIndex: clamp(at, 0, Math.max(0, state.branches.length - 1))
12894
12964
  });
12965
+ grownBy = (state, delta) => {
12966
+ const held = state.selecting ? state : {
12967
+ ...state,
12968
+ selecting: true,
12969
+ anchorRow: state.cursor
12970
+ };
12971
+ return withCursorVisible({
12972
+ ...held,
12973
+ stop: 0,
12974
+ cursor: clamp(held.cursor + delta, 0, lastRow(selectedPatch(state)))
12975
+ });
12976
+ };
12895
12977
  startSelection = (state) => ({
12896
12978
  ...state,
12897
12979
  selecting: true,
@@ -12998,6 +13080,8 @@ var init_reduce = __esmMin((() => {
12998
13080
  "file.next": (state) => moveFile(state, 1),
12999
13081
  "file.prev": (state) => moveFile(state, -1),
13000
13082
  "select.start": startSelection,
13083
+ "select.grow": (state) => grownBy(state, 1),
13084
+ "select.shrink": (state) => grownBy(state, -1),
13001
13085
  "select.hunk": selectHunk,
13002
13086
  "select.swap": swapEnds,
13003
13087
  "compose.open": openCompose,
@@ -13302,6 +13386,14 @@ var init_reduce = __esmMin((() => {
13302
13386
  ...state,
13303
13387
  caret: caretByWord(state, delta)
13304
13388
  });
13389
+ caretRowed = (state, delta) => ({
13390
+ ...state,
13391
+ caret: caretByRow(state, delta)
13392
+ });
13393
+ caretEnded = (state, edge) => ({
13394
+ ...state,
13395
+ caret: edge === "start" ? 0 : state.draft.length
13396
+ });
13305
13397
  caretHomed = (state, edge) => ({
13306
13398
  ...state,
13307
13399
  caret: caretToEdge(state, edge)
@@ -14129,7 +14221,7 @@ var init_diffview = __esmMin((() => {
14129
14221
  }));
14130
14222
  //#endregion
14131
14223
  //#region src/tui/render.ts
14132
- var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, COMPOSE_PAD, COMPOSE_MIN_TEXT, 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_TAIL, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, 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, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, makeComposeParts, makeCompose, clip, clipHead, clipMiddle, clipPath, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, contextLabel, nameRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, 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, panelMark, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelText, Screen;
14224
+ 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_TAIL, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, CARET_ROOM, draftText, laidOut$1, STICKY_MAX, pickPaint, SELECTION, CURSOR, ACCENT, GAP_PAINT, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, makeComposeParts, makeCompose, clip, clipHead, clipMiddle, clipPath, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, contextLabel, nameRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, 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, panelMark, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelText, Screen;
14133
14225
  var init_render = __esmMin((() => {
14134
14226
  init_command();
14135
14227
  init_patch();
@@ -14147,8 +14239,6 @@ var init_render = __esmMin((() => {
14147
14239
  MODAL_ROOM = 8;
14148
14240
  COMPOSE_CHROME = 3;
14149
14241
  COMPOSE_ACTION_ROWS = 2;
14150
- COMPOSE_PAD = 5;
14151
- COMPOSE_MIN_TEXT = 8;
14152
14242
  reportActions = (full) => t`${fg(palette.accent)("esc")} ${fg(palette.muted)("cancel")} ${fg(palette.accent)("^t")} ${fg(palette.muted)(full ? "sending everything" : "sending the least")} ${fg(palette.accent)("^s")} ${fg(palette.muted)("copy and save")}`;
14153
14243
  actionsText = () => t`${fg(palette.accent)("esc")} ${fg(palette.muted)("cancel")} ${fg(palette.accent)("^s")} ${fg(palette.muted)("send it")}`;
14154
14244
  SNIPPET_LINES = 4;
@@ -14184,11 +14274,30 @@ var init_render = __esmMin((() => {
14184
14274
  panelWidth = (width) => modalWidth(width, shareOf(width, PALETTE_WIDTH));
14185
14275
  panelTop = (height, part) => Math.max(2, Math.floor(height / part));
14186
14276
  panelRows = (height, part) => Math.max(PANEL_FLOOR, height - panelTop(height, part) - PANEL_FOOT);
14187
- composeRoom = (width) => {
14188
- const box = modalWidth(width, COMPOSE_WIDTH);
14277
+ composeRoom = (width) => ({
14278
+ box: composeBox(width),
14279
+ text: composeRoom$1(width)
14280
+ });
14281
+ CARET_ROOM = 1;
14282
+ draftText = (state, room) => {
14283
+ const rows = laidDraft(state.draft, room);
14284
+ const at = caretAt(state);
14285
+ const here = caretRow(rows, at);
14286
+ const column = caretColumn(rows, at);
14189
14287
  return {
14190
- box,
14191
- text: Math.max(COMPOSE_MIN_TEXT, box - COMPOSE_PAD)
14288
+ rows: rows.flatMap((row, index) => {
14289
+ const tail = index === rows.length - 1 ? "" : "\n";
14290
+ if (index !== here) return [fg(palette.ink)(`${row.text}${tail}`)];
14291
+ const before = row.text.slice(0, column);
14292
+ const under = row.text.slice(column, column + CARET_ROOM);
14293
+ const after = row.text.slice(column + CARET_ROOM);
14294
+ return [
14295
+ fg(palette.ink)(before),
14296
+ bg(palette.ink)(fg(palette.panel)(under.length === 0 ? " " : under)),
14297
+ fg(palette.ink)(`${after}${tail}`)
14298
+ ];
14299
+ }),
14300
+ height: rows.length
14192
14301
  };
14193
14302
  };
14194
14303
  laidOut$1 = (lines, room) => lines.flatMap((line) => {
@@ -15239,15 +15348,13 @@ var init_render = __esmMin((() => {
15239
15348
  this.compose.visible = state.screen === "compose" || state.screen === "report";
15240
15349
  if (state.screen !== "report") return;
15241
15350
  const room = composeRoom(this.renderer.width);
15242
- const lines = laidOut$1([
15243
- state.reportFull ? "What went wrong? Everything on screen is attached for you." : "What went wrong? Only what you type is sent.",
15244
- "",
15245
- drafted(state)
15246
- ], room.text);
15351
+ const asked = state.reportFull ? "What went wrong? Everything on screen is attached for you." : "What went wrong? Only what you type is sent.";
15352
+ const written = draftText(state, room.text);
15353
+ const lead = laidOut$1([asked, ""], room.text);
15247
15354
  this.composeTitle.content = "Report a bug";
15248
- this.composeBody.content = lines.join("\n");
15355
+ this.composeBody.content = new StyledText([...lead.map((line) => fg(palette.muted)(`${line}\n`)), ...written.rows]);
15249
15356
  this.composeActions.content = reportActions(state.reportFull);
15250
- this.compose.height = lines.length + COMPOSE_ACTION_ROWS + COMPOSE_CHROME;
15357
+ this.compose.height = lead.length + written.height + COMPOSE_ACTION_ROWS + COMPOSE_CHROME;
15251
15358
  this.compose.width = room.box;
15252
15359
  this.compose.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room.box) / 2));
15253
15360
  this.compose.top = Math.max(2, Math.floor(this.renderer.height / 4));
@@ -15299,16 +15406,11 @@ var init_render = __esmMin((() => {
15299
15406
  const more = selectedLineCount(state) - snippet.length;
15300
15407
  const tail = more > 0 ? [` … ${more} more lines`] : [];
15301
15408
  const quoted = [...snippet, ...tail].map((line) => clip(line, room.text));
15302
- const written = laidOut$1(drafted(state).split("\n"), room.text);
15303
- const lines = [
15304
- ...quoted,
15305
- "",
15306
- ...written
15307
- ];
15409
+ const written = draftText(state, room.text);
15308
15410
  this.composeTitle.content = clip(composeTarget(state), room.text);
15309
- this.composeBody.content = lines.join("\n");
15411
+ this.composeBody.content = new StyledText([...[...quoted, ""].map((line) => fg(palette.muted)(`${line}\n`)), ...written.rows]);
15310
15412
  this.composeActions.content = actionsText();
15311
- const height = lines.length + COMPOSE_ACTION_ROWS + COMPOSE_CHROME;
15413
+ const height = quoted.length + 1 + written.height + COMPOSE_ACTION_ROWS + COMPOSE_CHROME;
15312
15414
  this.compose.height = height;
15313
15415
  this.compose.width = room.box;
15314
15416
  this.compose.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room.box) / 2));
@@ -15426,7 +15528,7 @@ var init_upgrade = __esmMin((() => {
15426
15528
  return due ? `adiff ${latest} is out · adiff upgrade` : "";
15427
15529
  }).pipe(withSpan("Tui.upgradeHint"));
15428
15530
  upgradeHint = worded.pipe(orElseSucceed(() => ""));
15429
- })), PRINTABLE, KEY_HISTORY, TRAIL_HISTORY, clockOf, momentOf, noticeOf, handOver, copyToClipboard, lineUnder, asKey, openedPull, byWord, WORD_STEP, caretSideways, caretFor, erasedBy, LISTENS, listens, laidOut, keyName, App, turnedOver, settledPath, openingOn, launch, told, untilDestroyed, runOn, runTui;
15531
+ })), PRINTABLE, KEY_HISTORY, TRAIL_HISTORY, clockOf, momentOf, noticeOf, handOver, copyToClipboard, lineUnder, asKey, openedPull, byWord, WORD_STEP, caretSideways, caretFor, erasedBy, LISTENS, listens, laidOut, ARROWS, keyName, App, turnedOver, settledPath, openingOn, launch, told, untilDestroyed, runOn, runTui;
15430
15532
  var init_app = __esmMin((() => {
15431
15533
  init_dist();
15432
15534
  init_report();
@@ -15491,7 +15593,7 @@ var init_app = __esmMin((() => {
15491
15593
  if (!opened) return "could not reach the pull request";
15492
15594
  return state.length === 0 ? "opened the pull request" : `opened the ${state} pull request`;
15493
15595
  };
15494
- byWord = (key) => key.option || key.meta || key.ctrl;
15596
+ byWord = (key) => key.option || key.ctrl;
15495
15597
  WORD_STEP = {
15496
15598
  b: -1,
15497
15599
  f: 1
@@ -15499,7 +15601,8 @@ var init_app = __esmMin((() => {
15499
15601
  caretSideways = (state, key) => {
15500
15602
  const step = key.name === "left" ? -1 : key.name === "right" ? 1 : 0;
15501
15603
  if (step === 0) return void 0;
15502
- return byWord(key) ? caretJumped(state, step) : caretMoved(state, step);
15604
+ if (key.meta) return caretHomed(state, step > 0 ? "end" : "start");
15605
+ return key.option || key.ctrl ? caretJumped(state, step) : caretMoved(state, step);
15503
15606
  };
15504
15607
  caretFor = (state, key) => {
15505
15608
  const sideways = caretSideways(state, key);
@@ -15517,8 +15620,14 @@ var init_app = __esmMin((() => {
15517
15620
  LISTENS = /* @__PURE__ */ new Set(["keys", "palette"]);
15518
15621
  listens = (screen) => LISTENS.has(screen);
15519
15622
  laidOut = (key) => key.baseCode === void 0 || key.name.length !== 1 ? key.name : String.fromCodePoint(key.baseCode);
15623
+ ARROWS = /* @__PURE__ */ new Set([
15624
+ "up",
15625
+ "down",
15626
+ "left",
15627
+ "right"
15628
+ ]);
15520
15629
  keyName = (key) => {
15521
- if (key.shift && key.name === "tab") return "shift+tab";
15630
+ if (key.shift && (key.name === "tab" || ARROWS.has(key.name))) return `shift+${key.name}`;
15522
15631
  const named = laidOut(key);
15523
15632
  const base = key.shift && named.length === 1 ? named.toUpperCase() : named;
15524
15633
  return key.ctrl ? `ctrl+${base}` : base;
@@ -15893,17 +16002,19 @@ var init_app = __esmMin((() => {
15893
16002
  this.commit(erasedBy(this.state, key));
15894
16003
  return;
15895
16004
  }
15896
- if (key.name === "down") {
15897
- this.commit(paletteMoved(this.state, 1));
15898
- return;
15899
- }
15900
- if (key.name === "up") {
15901
- this.commit(paletteMoved(this.state, -1));
16005
+ if (key.name === "down" || key.name === "up") {
16006
+ this.commit(this.steppedText(key));
15902
16007
  return;
15903
16008
  }
15904
16009
  if (this.onCaret(key)) return;
15905
16010
  if (PRINTABLE.test(key.sequence)) this.commit(typed(this.state, key.sequence));
15906
16011
  }
16012
+ steppedText(key) {
16013
+ const delta = key.name === "down" ? 1 : -1;
16014
+ if (listens(this.state.screen)) return paletteMoved(this.state, delta);
16015
+ if (key.meta) return caretEnded(this.state, delta > 0 ? "end" : "start");
16016
+ return caretRowed(this.measured(), delta);
16017
+ }
15907
16018
  onCaret(key) {
15908
16019
  if (this.state.screen === "palette" || this.state.screen === "keys") return false;
15909
16020
  const moved = caretFor(this.state, key);
@@ -16458,10 +16569,14 @@ var tui_exports = /* @__PURE__ */ __exportAll({
16458
16569
  App: () => App,
16459
16570
  Screen: () => Screen,
16460
16571
  actionFor: () => actionFor,
16572
+ caretColumn: () => caretColumn,
16573
+ caretOn: () => caretOn,
16574
+ caretRow: () => caretRow,
16461
16575
  commands: () => commands,
16462
16576
  commandsFor: () => commandsFor,
16463
16577
  hintsFor: () => hintsFor,
16464
16578
  initialState: () => initialState,
16579
+ laidDraft: () => laidDraft,
16465
16580
  launch: () => launch,
16466
16581
  listableFor: () => listableFor,
16467
16582
  palette: () => palette,
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.73",
26
+ "version": "0.1.0-alpha.74",
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": {