@eliya-oss/agent-diff 0.1.0-alpha.74 → 0.1.0-alpha.76
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 +16 -0
- package/dist/main.js +215 -224
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @eliya-oss/agent-diff
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.76
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- The filter above the palette and the sheet of keys is a real text box now, like the one a comment is written in: a caret you can move, word jumps, and selection. `return` in a comment belongs to the box, so `shift+return` breaks a line rather than doing nothing.
|
|
8
|
+
|
|
9
|
+
## 0.1.0-alpha.75
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- The suite runs in three parts at once, so a change reaches a release in about half the time it took.
|
|
14
|
+
|
|
15
|
+
- Cmd and option in the compose box now do what they do everywhere else: cmd moves to the ends of a line or the draft, option moves by word, and a key held with a modifier is never typed. Letting go of shift after growing a selection opens the comment on it.
|
|
16
|
+
|
|
17
|
+
- The box a comment is written in is opentui's textarea now, rather than one written here: the caret is the terminal's own, and undo, selection, and word and line movement come with it. Cmd and option keys the box does not carry by default are added to it.
|
|
18
|
+
|
|
3
19
|
## 0.1.0-alpha.74
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/main.js
CHANGED
|
@@ -5,9 +5,9 @@ import { text } from "node:stream/consumers";
|
|
|
5
5
|
import { dirname, join, resolve } from "node:path";
|
|
6
6
|
import { execFile, spawn } from "node:child_process";
|
|
7
7
|
import { promisify } from "node:util";
|
|
8
|
-
import {
|
|
8
|
+
import { existsSync, mkdirSync, readFileSync, realpathSync, watch } from "node:fs";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
|
-
import { ASCIIFontRenderable, BoxRenderable, CodeRenderable, LineNumberRenderable, RGBA, StyledText, SyntaxStyle, TextRenderable, bg, createCliRenderer,
|
|
10
|
+
import { ASCIIFontRenderable, BoxRenderable, CodeRenderable, LineNumberRenderable, RGBA, StyledText, SyntaxStyle, TextRenderable, TextareaRenderable, bg, createCliRenderer, defaultTextareaKeyBindings, fg, getTreeSitterClient, pathToFiletype, stripAnsiSequences, t } from "@opentui/core";
|
|
11
11
|
//#region \0rolldown/runtime.js
|
|
12
12
|
var __defProp = Object.defineProperty;
|
|
13
13
|
var __esmMin = (fn, res, err) => () => {
|
|
@@ -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.
|
|
9664
|
+
var version$1 = "0.1.0-alpha.76";
|
|
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, brokenAt, laidLine, laidDraft, caretRow, caretColumn, caretOn,
|
|
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, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, 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();
|
|
@@ -11694,41 +11694,12 @@ var init_model = __esmMin((() => {
|
|
|
11694
11694
|
const last = held.text.endsWith(" ") ? held.text.length - 1 : held.text.length;
|
|
11695
11695
|
return held.from + Math.min(column, Math.max(0, last));
|
|
11696
11696
|
};
|
|
11697
|
-
caretAt = (state) => Math.max(0, Math.min(state.draft.length, state.caret));
|
|
11698
|
-
WORD = /[\p{L}\p{N}_]/u;
|
|
11699
|
-
wordLeft = (draft, from) => {
|
|
11700
|
-
let at = from;
|
|
11701
|
-
while (at > 0 && !WORD.test(draft[at - 1] ?? "")) at -= 1;
|
|
11702
|
-
while (at > 0 && WORD.test(draft[at - 1] ?? "")) at -= 1;
|
|
11703
|
-
return at;
|
|
11704
|
-
};
|
|
11705
|
-
wordRight = (draft, from) => {
|
|
11706
|
-
let at = from;
|
|
11707
|
-
while (at < draft.length && !WORD.test(draft[at] ?? "")) at += 1;
|
|
11708
|
-
while (at < draft.length && WORD.test(draft[at] ?? "")) at += 1;
|
|
11709
|
-
return at;
|
|
11710
|
-
};
|
|
11711
|
-
caretByWord = (state, delta) => delta < 0 ? wordLeft(state.draft, caretAt(state)) : wordRight(state.draft, caretAt(state));
|
|
11712
|
-
lineStart = (draft, at) => draft.lastIndexOf("\n", at - 1) + 1;
|
|
11713
|
-
lineEnd = (draft, at) => {
|
|
11714
|
-
const found = draft.indexOf("\n", at);
|
|
11715
|
-
return found === -1 ? draft.length : found;
|
|
11716
|
-
};
|
|
11717
11697
|
COMPOSE_BOX = 72;
|
|
11718
11698
|
COMPOSE_MARGIN = 4;
|
|
11719
11699
|
COMPOSE_PAD = 5;
|
|
11720
11700
|
COMPOSE_LEAST = 8;
|
|
11721
11701
|
composeBox = (columns) => Math.max(0, Math.min(COMPOSE_BOX, columns - COMPOSE_MARGIN));
|
|
11722
11702
|
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
|
-
};
|
|
11731
|
-
caretToEdge = (state, edge) => edge === "start" ? lineStart(state.draft, caretAt(state)) : lineEnd(state.draft, caretAt(state));
|
|
11732
11703
|
composeTarget = (state) => {
|
|
11733
11704
|
const patch = selectedPatch(state);
|
|
11734
11705
|
if (patch === void 0) return "";
|
|
@@ -12548,14 +12519,6 @@ var init_command = __esmMin((() => {
|
|
|
12548
12519
|
hint: "send",
|
|
12549
12520
|
listed: false
|
|
12550
12521
|
}),
|
|
12551
|
-
command({
|
|
12552
|
-
action: "compose.newline",
|
|
12553
|
-
category: "Comments",
|
|
12554
|
-
title: "New line",
|
|
12555
|
-
keys: ["return"],
|
|
12556
|
-
screens: ["compose"],
|
|
12557
|
-
listed: false
|
|
12558
|
-
}),
|
|
12559
12522
|
command({
|
|
12560
12523
|
action: "palette.run",
|
|
12561
12524
|
category: "App",
|
|
@@ -12687,7 +12650,7 @@ var init_match = __esmMin((() => {
|
|
|
12687
12650
|
}));
|
|
12688
12651
|
//#endregion
|
|
12689
12652
|
//#region src/tui/reduce.ts
|
|
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,
|
|
12653
|
+
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, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, withDraft, paletteMoved, paletteClosed, withWaiting, withMatches, withNoticeHere, withNotice;
|
|
12691
12654
|
var init_reduce = __esmMin((() => {
|
|
12692
12655
|
init_dist();
|
|
12693
12656
|
init_patch();
|
|
@@ -13086,7 +13049,6 @@ var init_reduce = __esmMin((() => {
|
|
|
13086
13049
|
"select.swap": swapEnds,
|
|
13087
13050
|
"compose.open": openCompose,
|
|
13088
13051
|
"compose.submit": (state) => state,
|
|
13089
|
-
"compose.newline": (state) => inserted(state, "\n"),
|
|
13090
13052
|
"focus.toggle": (state) => ({
|
|
13091
13053
|
...state,
|
|
13092
13054
|
focus: focusStepped(state, 1),
|
|
@@ -13315,20 +13277,6 @@ var init_reduce = __esmMin((() => {
|
|
|
13315
13277
|
anchorRow: 0,
|
|
13316
13278
|
selecting: false
|
|
13317
13279
|
});
|
|
13318
|
-
inserted = (state, text) => {
|
|
13319
|
-
const at = caretAt(state);
|
|
13320
|
-
return {
|
|
13321
|
-
...state,
|
|
13322
|
-
draft: `${state.draft.slice(0, at)}${text}${state.draft.slice(at)}`,
|
|
13323
|
-
caret: at + text.length
|
|
13324
|
-
};
|
|
13325
|
-
};
|
|
13326
|
-
asksAQuery = (state) => state.screen === "palette" || state.screen === "keys";
|
|
13327
|
-
typed = (state, character) => asksAQuery(state) ? {
|
|
13328
|
-
...state,
|
|
13329
|
-
query: `${state.query}${character}`,
|
|
13330
|
-
paletteIndex: 0
|
|
13331
|
-
} : inserted(state, character);
|
|
13332
13280
|
TAB_WIDTH = 2;
|
|
13333
13281
|
SPACE_CODE = 32;
|
|
13334
13282
|
ERASED_FROM = 127;
|
|
@@ -13339,64 +13287,10 @@ var init_reduce = __esmMin((() => {
|
|
|
13339
13287
|
return code >= SPACE_CODE && (code < ERASED_FROM || code > ERASED_TO);
|
|
13340
13288
|
};
|
|
13341
13289
|
legible = (text) => Array.from(text.replace(/\r\n?/g, "\n").replace(/\t/g, " ".repeat(TAB_WIDTH))).filter(readable).join("");
|
|
13342
|
-
|
|
13343
|
-
const clean = legible(stripAnsiSequences(text));
|
|
13344
|
-
if (clean.length === 0) return state;
|
|
13345
|
-
return typed(state, asksAQuery(state) ? clean.replace(/\n/g, " ") : clean);
|
|
13346
|
-
};
|
|
13347
|
-
backspaced = (state) => {
|
|
13348
|
-
if (asksAQuery(state)) return {
|
|
13349
|
-
...state,
|
|
13350
|
-
query: state.query.slice(0, -1),
|
|
13351
|
-
paletteIndex: 0
|
|
13352
|
-
};
|
|
13353
|
-
const at = caretAt(state);
|
|
13354
|
-
if (at === 0) return state;
|
|
13355
|
-
return {
|
|
13356
|
-
...state,
|
|
13357
|
-
draft: `${state.draft.slice(0, at - 1)}${state.draft.slice(at)}`,
|
|
13358
|
-
caret: at - 1
|
|
13359
|
-
};
|
|
13360
|
-
};
|
|
13361
|
-
cutBackTo = (state, to) => {
|
|
13362
|
-
const at = caretAt(state);
|
|
13363
|
-
if (to >= at) return state;
|
|
13364
|
-
return {
|
|
13365
|
-
...state,
|
|
13366
|
-
draft: `${state.draft.slice(0, to)}${state.draft.slice(at)}`,
|
|
13367
|
-
caret: to
|
|
13368
|
-
};
|
|
13369
|
-
};
|
|
13370
|
-
wordBackspaced = (state) => asksAQuery(state) ? backspaced(state) : cutBackTo(state, caretByWord(state, -1));
|
|
13371
|
-
lineBackspaced = (state) => asksAQuery(state) ? backspaced(state) : cutBackTo(state, caretToEdge(state, "start"));
|
|
13372
|
-
deleted = (state) => {
|
|
13373
|
-
const at = caretAt(state);
|
|
13374
|
-
if (at >= state.draft.length) return state;
|
|
13375
|
-
return {
|
|
13376
|
-
...state,
|
|
13377
|
-
draft: `${state.draft.slice(0, at)}${state.draft.slice(at + 1)}`,
|
|
13378
|
-
caret: at
|
|
13379
|
-
};
|
|
13380
|
-
};
|
|
13381
|
-
caretMoved = (state, delta) => ({
|
|
13382
|
-
...state,
|
|
13383
|
-
caret: clamp(caretAt(state) + delta, 0, state.draft.length)
|
|
13384
|
-
});
|
|
13385
|
-
caretJumped = (state, delta) => ({
|
|
13386
|
-
...state,
|
|
13387
|
-
caret: caretByWord(state, delta)
|
|
13388
|
-
});
|
|
13389
|
-
caretRowed = (state, delta) => ({
|
|
13390
|
-
...state,
|
|
13391
|
-
caret: caretByRow(state, delta)
|
|
13392
|
-
});
|
|
13393
|
-
caretEnded = (state, edge) => ({
|
|
13290
|
+
withDraft = (state, draft) => ({
|
|
13394
13291
|
...state,
|
|
13395
|
-
|
|
13396
|
-
|
|
13397
|
-
caretHomed = (state, edge) => ({
|
|
13398
|
-
...state,
|
|
13399
|
-
caret: caretToEdge(state, edge)
|
|
13292
|
+
draft,
|
|
13293
|
+
caret: draft.length
|
|
13400
13294
|
});
|
|
13401
13295
|
paletteMoved = (state, delta) => movePalette(state, delta);
|
|
13402
13296
|
paletteClosed = (state) => ({
|
|
@@ -14221,7 +14115,7 @@ var init_diffview = __esmMin((() => {
|
|
|
14221
14115
|
}));
|
|
14222
14116
|
//#endregion
|
|
14223
14117
|
//#region src/tui/render.ts
|
|
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,
|
|
14118
|
+
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, 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, 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;
|
|
14225
14119
|
var init_render = __esmMin((() => {
|
|
14226
14120
|
init_command();
|
|
14227
14121
|
init_patch();
|
|
@@ -14278,28 +14172,6 @@ var init_render = __esmMin((() => {
|
|
|
14278
14172
|
box: composeBox(width),
|
|
14279
14173
|
text: composeRoom$1(width)
|
|
14280
14174
|
});
|
|
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);
|
|
14287
|
-
return {
|
|
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
|
|
14301
|
-
};
|
|
14302
|
-
};
|
|
14303
14175
|
laidOut$1 = (lines, room) => lines.flatMap((line) => {
|
|
14304
14176
|
const parts = wrapped(line, room);
|
|
14305
14177
|
return parts.length === 0 ? [""] : parts;
|
|
@@ -14438,10 +14310,25 @@ var init_render = __esmMin((() => {
|
|
|
14438
14310
|
box.width = PALETTE_WIDTH;
|
|
14439
14311
|
return box;
|
|
14440
14312
|
};
|
|
14313
|
+
asking = (renderer, id) => new TextareaRenderable(renderer, {
|
|
14314
|
+
id,
|
|
14315
|
+
height: ROW_HEIGHT,
|
|
14316
|
+
wrapMode: "none",
|
|
14317
|
+
flexShrink: 0,
|
|
14318
|
+
marginLeft: GUTTER_X,
|
|
14319
|
+
marginRight: GUTTER_X,
|
|
14320
|
+
placeholder: "Type to filter…",
|
|
14321
|
+
placeholderColor: palette.faint,
|
|
14322
|
+
backgroundColor: palette.panel,
|
|
14323
|
+
focusedBackgroundColor: palette.panel,
|
|
14324
|
+
textColor: palette.ink,
|
|
14325
|
+
focusedTextColor: palette.ink,
|
|
14326
|
+
cursorColor: palette.ink
|
|
14327
|
+
});
|
|
14441
14328
|
makePaletteParts = (renderer) => {
|
|
14442
14329
|
const box = makePalette(renderer);
|
|
14443
14330
|
const title = bar(renderer, "palette-title", palette.faint);
|
|
14444
|
-
const query =
|
|
14331
|
+
const query = asking(renderer, "palette-query");
|
|
14445
14332
|
const choices = makeChoices(renderer);
|
|
14446
14333
|
box.add(title);
|
|
14447
14334
|
box.add(query);
|
|
@@ -14511,16 +14398,16 @@ var init_render = __esmMin((() => {
|
|
|
14511
14398
|
makeFoundParts = (renderer) => {
|
|
14512
14399
|
const box = makePalette(renderer);
|
|
14513
14400
|
const title = bar(renderer, "found-title", palette.faint);
|
|
14514
|
-
const
|
|
14401
|
+
const peek = bar(renderer, "found-peek", palette.muted);
|
|
14515
14402
|
const choices = makeChoices(renderer);
|
|
14516
14403
|
box.id = "found";
|
|
14517
14404
|
box.add(title);
|
|
14518
14405
|
box.add(choices);
|
|
14519
|
-
box.add(
|
|
14406
|
+
box.add(peek);
|
|
14520
14407
|
return {
|
|
14521
14408
|
box,
|
|
14522
14409
|
title,
|
|
14523
|
-
|
|
14410
|
+
peek,
|
|
14524
14411
|
choices
|
|
14525
14412
|
};
|
|
14526
14413
|
};
|
|
@@ -14555,6 +14442,60 @@ var init_render = __esmMin((() => {
|
|
|
14555
14442
|
marginBottom: 2,
|
|
14556
14443
|
flexShrink: 0
|
|
14557
14444
|
});
|
|
14445
|
+
MAC_KEYS = [
|
|
14446
|
+
{
|
|
14447
|
+
name: "left",
|
|
14448
|
+
super: true,
|
|
14449
|
+
action: "line-home"
|
|
14450
|
+
},
|
|
14451
|
+
{
|
|
14452
|
+
name: "right",
|
|
14453
|
+
super: true,
|
|
14454
|
+
action: "line-end"
|
|
14455
|
+
},
|
|
14456
|
+
{
|
|
14457
|
+
name: "left",
|
|
14458
|
+
super: true,
|
|
14459
|
+
shift: true,
|
|
14460
|
+
action: "select-line-home"
|
|
14461
|
+
},
|
|
14462
|
+
{
|
|
14463
|
+
name: "right",
|
|
14464
|
+
super: true,
|
|
14465
|
+
shift: true,
|
|
14466
|
+
action: "select-line-end"
|
|
14467
|
+
},
|
|
14468
|
+
{
|
|
14469
|
+
name: "up",
|
|
14470
|
+
super: true,
|
|
14471
|
+
action: "buffer-home"
|
|
14472
|
+
},
|
|
14473
|
+
{
|
|
14474
|
+
name: "down",
|
|
14475
|
+
super: true,
|
|
14476
|
+
action: "buffer-end"
|
|
14477
|
+
},
|
|
14478
|
+
{
|
|
14479
|
+
name: "backspace",
|
|
14480
|
+
super: true,
|
|
14481
|
+
action: "delete-to-line-start"
|
|
14482
|
+
},
|
|
14483
|
+
{
|
|
14484
|
+
name: "backspace",
|
|
14485
|
+
meta: true,
|
|
14486
|
+
action: "delete-word-backward"
|
|
14487
|
+
},
|
|
14488
|
+
{
|
|
14489
|
+
name: "return",
|
|
14490
|
+
shift: true,
|
|
14491
|
+
action: "newline"
|
|
14492
|
+
},
|
|
14493
|
+
{
|
|
14494
|
+
name: "return",
|
|
14495
|
+
meta: true,
|
|
14496
|
+
action: "newline"
|
|
14497
|
+
}
|
|
14498
|
+
];
|
|
14558
14499
|
makeComposeParts = (renderer) => ({
|
|
14559
14500
|
title: new TextRenderable(renderer, {
|
|
14560
14501
|
id: "compose-title",
|
|
@@ -14562,12 +14503,23 @@ var init_render = __esmMin((() => {
|
|
|
14562
14503
|
fg: palette.ink,
|
|
14563
14504
|
wrapMode: "none"
|
|
14564
14505
|
}),
|
|
14565
|
-
|
|
14566
|
-
id: "compose-
|
|
14506
|
+
quoted: new TextRenderable(renderer, {
|
|
14507
|
+
id: "compose-quoted",
|
|
14567
14508
|
content: "",
|
|
14568
|
-
fg: palette.
|
|
14509
|
+
fg: palette.muted,
|
|
14569
14510
|
wrapMode: "none"
|
|
14570
14511
|
}),
|
|
14512
|
+
body: new TextareaRenderable(renderer, {
|
|
14513
|
+
id: "compose-body",
|
|
14514
|
+
wrapMode: "word",
|
|
14515
|
+
keyBindings: [...defaultTextareaKeyBindings, ...MAC_KEYS],
|
|
14516
|
+
backgroundColor: palette.panel,
|
|
14517
|
+
focusedBackgroundColor: palette.panel,
|
|
14518
|
+
textColor: palette.ink,
|
|
14519
|
+
focusedTextColor: palette.ink,
|
|
14520
|
+
cursorColor: palette.ink,
|
|
14521
|
+
placeholder: ""
|
|
14522
|
+
}),
|
|
14571
14523
|
actions: new TextRenderable(renderer, {
|
|
14572
14524
|
id: "compose-actions",
|
|
14573
14525
|
content: "",
|
|
@@ -14870,6 +14822,7 @@ var init_render = __esmMin((() => {
|
|
|
14870
14822
|
shown;
|
|
14871
14823
|
chips = [];
|
|
14872
14824
|
composeTitle;
|
|
14825
|
+
composeQuoted;
|
|
14873
14826
|
composeBody;
|
|
14874
14827
|
composeActions;
|
|
14875
14828
|
footer;
|
|
@@ -14916,6 +14869,7 @@ var init_render = __esmMin((() => {
|
|
|
14916
14869
|
const inside = makeComposeParts(renderer);
|
|
14917
14870
|
this.compose = makeCompose(renderer);
|
|
14918
14871
|
this.composeTitle = inside.title;
|
|
14872
|
+
this.composeQuoted = inside.quoted;
|
|
14919
14873
|
this.composeBody = inside.body;
|
|
14920
14874
|
this.composeActions = inside.actions;
|
|
14921
14875
|
this.scrim = makeScrim(renderer);
|
|
@@ -14931,7 +14885,7 @@ var init_render = __esmMin((() => {
|
|
|
14931
14885
|
this.keysChoices = modals.keys.choices;
|
|
14932
14886
|
this.found = modals.found.box;
|
|
14933
14887
|
this.foundTitle = modals.found.title;
|
|
14934
|
-
this.foundPeek = modals.found.
|
|
14888
|
+
this.foundPeek = modals.found.peek;
|
|
14935
14889
|
this.foundChoices = modals.found.choices;
|
|
14936
14890
|
this.assemble(renderer);
|
|
14937
14891
|
}
|
|
@@ -14999,6 +14953,13 @@ var init_render = __esmMin((() => {
|
|
|
14999
14953
|
tallestRows() {
|
|
15000
14954
|
return this.view.tallestRows();
|
|
15001
14955
|
}
|
|
14956
|
+
writing() {
|
|
14957
|
+
return this.composeBody;
|
|
14958
|
+
}
|
|
14959
|
+
asking(screen) {
|
|
14960
|
+
if (screen === "palette") return this.paletteQuery;
|
|
14961
|
+
return screen === "keys" ? this.keysQuery : void 0;
|
|
14962
|
+
}
|
|
15002
14963
|
railRows() {
|
|
15003
14964
|
return this.listRoom();
|
|
15004
14965
|
}
|
|
@@ -15052,14 +15013,12 @@ var init_render = __esmMin((() => {
|
|
|
15052
15013
|
paintPalette(state) {
|
|
15053
15014
|
this.palette.visible = state.screen === "palette";
|
|
15054
15015
|
if (state.screen !== "palette") {
|
|
15055
|
-
this.paletteQuery.content = "";
|
|
15056
15016
|
this.paletteTitle.content = "";
|
|
15057
15017
|
this.paletteChoices.content = "";
|
|
15058
15018
|
return;
|
|
15059
15019
|
}
|
|
15060
15020
|
const matches = paletteMatches(state);
|
|
15061
15021
|
this.paletteTitle.content = matches.length === 0 ? "No command matches" : "Commands";
|
|
15062
|
-
this.paletteQuery.content = state.query.length === 0 ? "Type to filter…" : `${state.query}▏`;
|
|
15063
15022
|
const room = panelWidth(this.renderer.width);
|
|
15064
15023
|
const paletteRoom = Math.min(panelRows(this.renderer.height, PANEL_QUARTER), matches.length + PALETTE_CHROME);
|
|
15065
15024
|
this.paletteChoices.content = listText(matches.map((entry) => commandRow(entry, room - MODAL_ROOM)), Math.min(state.paletteIndex, Math.max(0, matches.length - 1)), paletteRoom - PALETTE_CHROME);
|
|
@@ -15072,14 +15031,12 @@ var init_render = __esmMin((() => {
|
|
|
15072
15031
|
this.keys.visible = state.screen === "keys";
|
|
15073
15032
|
if (state.screen !== "keys") {
|
|
15074
15033
|
this.keysTitle.content = "";
|
|
15075
|
-
this.keysQuery.content = "";
|
|
15076
15034
|
this.keysChoices.content = "";
|
|
15077
15035
|
return;
|
|
15078
15036
|
}
|
|
15079
15037
|
const rows = keyMatches(state);
|
|
15080
15038
|
const room = panelWidth(this.renderer.width);
|
|
15081
15039
|
this.keysTitle.content = rows.length === 0 ? "No key matches" : `Keys here, ${rows.length} of them`;
|
|
15082
|
-
this.keysQuery.content = state.query.length === 0 ? "Type to filter…" : `${state.query}▏`;
|
|
15083
15040
|
const keysRoom = Math.min(panelRows(this.renderer.height, PANEL_QUARTER), rows.length + PENDING_CHROME);
|
|
15084
15041
|
this.keysChoices.content = listText(rows.map((entry) => commandRow(entry, room - MODAL_ROOM)), Math.min(state.paletteIndex, Math.max(0, rows.length - 1)), keysRoom - PENDING_CHROME);
|
|
15085
15042
|
this.keys.height = keysRoom;
|
|
@@ -15191,6 +15148,7 @@ var init_render = __esmMin((() => {
|
|
|
15191
15148
|
this.body.add(this.panelPane);
|
|
15192
15149
|
stack(this.compose, [
|
|
15193
15150
|
this.composeTitle,
|
|
15151
|
+
this.composeQuoted,
|
|
15194
15152
|
this.composeBody,
|
|
15195
15153
|
this.composeActions
|
|
15196
15154
|
]);
|
|
@@ -15349,12 +15307,13 @@ var init_render = __esmMin((() => {
|
|
|
15349
15307
|
if (state.screen !== "report") return;
|
|
15350
15308
|
const room = composeRoom(this.renderer.width);
|
|
15351
15309
|
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
|
|
15353
|
-
const lead = laidOut$1([asked, ""], room.text);
|
|
15310
|
+
const lead = laidOut$1([asked], room.text);
|
|
15354
15311
|
this.composeTitle.content = "Report a bug";
|
|
15355
|
-
this.
|
|
15312
|
+
this.composeQuoted.content = lead.join("\n");
|
|
15313
|
+
this.composeQuoted.height = lead.length;
|
|
15314
|
+
const written = this.fitBody(state, room.text);
|
|
15356
15315
|
this.composeActions.content = reportActions(state.reportFull);
|
|
15357
|
-
this.compose.height = lead.length + written
|
|
15316
|
+
this.compose.height = lead.length + written + COMPOSE_ACTION_ROWS + COMPOSE_CHROME;
|
|
15358
15317
|
this.compose.width = room.box;
|
|
15359
15318
|
this.compose.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room.box) / 2));
|
|
15360
15319
|
this.compose.top = Math.max(2, Math.floor(this.renderer.height / 4));
|
|
@@ -15395,22 +15354,26 @@ var init_render = __esmMin((() => {
|
|
|
15395
15354
|
});
|
|
15396
15355
|
};
|
|
15397
15356
|
}
|
|
15357
|
+
fitBody(state, room) {
|
|
15358
|
+
if (this.composeBody.width !== room) this.composeBody.width = room;
|
|
15359
|
+
const rows = Math.max(1, laidDraft(state.draft, room).length);
|
|
15360
|
+
if (this.composeBody.height !== rows) this.composeBody.height = rows;
|
|
15361
|
+
return rows;
|
|
15362
|
+
}
|
|
15398
15363
|
paintCompose(state) {
|
|
15399
15364
|
this.compose.visible = state.screen === "compose";
|
|
15400
|
-
if (state.screen !== "compose")
|
|
15401
|
-
this.composeBody.content = "";
|
|
15402
|
-
return;
|
|
15403
|
-
}
|
|
15365
|
+
if (state.screen !== "compose") return;
|
|
15404
15366
|
const room = composeRoom(this.renderer.width);
|
|
15405
15367
|
const snippet = snippetOf(state, SNIPPET_LINES);
|
|
15406
15368
|
const more = selectedLineCount(state) - snippet.length;
|
|
15407
15369
|
const tail = more > 0 ? [` … ${more} more lines`] : [];
|
|
15408
15370
|
const quoted = [...snippet, ...tail].map((line) => clip(line, room.text));
|
|
15409
|
-
const written = draftText(state, room.text);
|
|
15410
15371
|
this.composeTitle.content = clip(composeTarget(state), room.text);
|
|
15411
|
-
this.
|
|
15372
|
+
this.composeQuoted.content = [...quoted, ""].join("\n");
|
|
15373
|
+
this.composeQuoted.height = quoted.length + 1;
|
|
15374
|
+
const written = this.fitBody(state, room.text);
|
|
15412
15375
|
this.composeActions.content = actionsText();
|
|
15413
|
-
const height = quoted.length + 1 + written
|
|
15376
|
+
const height = quoted.length + 1 + written + COMPOSE_ACTION_ROWS + COMPOSE_CHROME;
|
|
15414
15377
|
this.compose.height = height;
|
|
15415
15378
|
this.compose.width = room.box;
|
|
15416
15379
|
this.compose.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room.box) / 2));
|
|
@@ -15420,10 +15383,11 @@ var init_render = __esmMin((() => {
|
|
|
15420
15383
|
}));
|
|
15421
15384
|
//#endregion
|
|
15422
15385
|
//#region src/tui/display.ts
|
|
15423
|
-
var Display, paintWith, listenWith, lightWith, shapeOf, displayOn;
|
|
15386
|
+
var ASKING, Display, paintWith, listenWith, lightWith, shapeOf, displayOn;
|
|
15424
15387
|
var init_display = __esmMin((() => {
|
|
15425
15388
|
init_dist();
|
|
15426
15389
|
init_render();
|
|
15390
|
+
ASKING = ["palette", "keys"];
|
|
15427
15391
|
Display = class extends Service()("adiff/Display") {};
|
|
15428
15392
|
paintWith = (screen) => fn("Tui.paint")(function* (state) {
|
|
15429
15393
|
yield* sync(() => screen.update(state));
|
|
@@ -15443,6 +15407,32 @@ var init_display = __esmMin((() => {
|
|
|
15443
15407
|
room: sync(() => screen.noteRoom()),
|
|
15444
15408
|
tallest: sync(() => screen.tallestRows()),
|
|
15445
15409
|
rail: sync(() => screen.railRows()),
|
|
15410
|
+
onWritten: (told) => sync(() => {
|
|
15411
|
+
screen.writing().onContentChange = () => told(screen.writing().plainText);
|
|
15412
|
+
}),
|
|
15413
|
+
written: sync(() => screen.writing().plainText),
|
|
15414
|
+
write: (text) => sync(() => screen.writing().setText(text)),
|
|
15415
|
+
writeIn: (text) => sync(() => screen.writing().insertText(text)),
|
|
15416
|
+
writeOn: (on) => sync(() => on ? screen.writing().focus() : screen.writing().blur()),
|
|
15417
|
+
askOn: (which) => sync(() => {
|
|
15418
|
+
for (const name of ASKING) {
|
|
15419
|
+
const box = screen.asking(name);
|
|
15420
|
+
if (box === void 0) continue;
|
|
15421
|
+
if (name === which) {
|
|
15422
|
+
box.setText("");
|
|
15423
|
+
box.focus();
|
|
15424
|
+
} else box.blur();
|
|
15425
|
+
}
|
|
15426
|
+
}),
|
|
15427
|
+
askWith: (text) => sync(() => {
|
|
15428
|
+
for (const name of ASKING) screen.asking(name)?.setText(text);
|
|
15429
|
+
}),
|
|
15430
|
+
onAsked: (told) => sync(() => {
|
|
15431
|
+
for (const name of ASKING) {
|
|
15432
|
+
const box = screen.asking(name);
|
|
15433
|
+
if (box !== void 0) box.onContentChange = () => told(box.plainText);
|
|
15434
|
+
}
|
|
15435
|
+
}),
|
|
15446
15436
|
at: sync(() => screen.scrolledAt()),
|
|
15447
15437
|
rowAt: (visual) => sync(() => screen.rowAtScreen(visual)),
|
|
15448
15438
|
screenRowOf: (row) => sync(() => screen.screenRowOf(row)),
|
|
@@ -15528,7 +15518,7 @@ var init_upgrade = __esmMin((() => {
|
|
|
15528
15518
|
return due ? `adiff ${latest} is out · adiff upgrade` : "";
|
|
15529
15519
|
}).pipe(withSpan("Tui.upgradeHint"));
|
|
15530
15520
|
upgradeHint = worded.pipe(orElseSucceed(() => ""));
|
|
15531
|
-
})),
|
|
15521
|
+
})), KEY_HISTORY, DRAIN_PASSES, TRAIL_HISTORY, clockOf, momentOf, noticeOf, handOver, copyToClipboard, lineUnder, asKey, openedPull, LISTENS, WRITES, writesInto, listens, laidOut, ARROWS, keyName, App, turnedOver, settledPath, openingOn, launch, told, untilDestroyed, runOn, runTui;
|
|
15532
15522
|
var init_app = __esmMin((() => {
|
|
15533
15523
|
init_dist();
|
|
15534
15524
|
init_report();
|
|
@@ -15545,8 +15535,8 @@ var init_app = __esmMin((() => {
|
|
|
15545
15535
|
init_intent();
|
|
15546
15536
|
init_session();
|
|
15547
15537
|
init_upgrade();
|
|
15548
|
-
PRINTABLE = /^[\S ]$/;
|
|
15549
15538
|
KEY_HISTORY = 40;
|
|
15539
|
+
DRAIN_PASSES = 8;
|
|
15550
15540
|
TRAIL_HISTORY = 20;
|
|
15551
15541
|
clockOf = (elapsed) => {
|
|
15552
15542
|
const seconds = Math.floor(elapsed / 1e3);
|
|
@@ -15593,31 +15583,9 @@ var init_app = __esmMin((() => {
|
|
|
15593
15583
|
if (!opened) return "could not reach the pull request";
|
|
15594
15584
|
return state.length === 0 ? "opened the pull request" : `opened the ${state} pull request`;
|
|
15595
15585
|
};
|
|
15596
|
-
byWord = (key) => key.option || key.ctrl;
|
|
15597
|
-
WORD_STEP = {
|
|
15598
|
-
b: -1,
|
|
15599
|
-
f: 1
|
|
15600
|
-
};
|
|
15601
|
-
caretSideways = (state, key) => {
|
|
15602
|
-
const step = key.name === "left" ? -1 : key.name === "right" ? 1 : 0;
|
|
15603
|
-
if (step === 0) return void 0;
|
|
15604
|
-
if (key.meta) return caretHomed(state, step > 0 ? "end" : "start");
|
|
15605
|
-
return key.option || key.ctrl ? caretJumped(state, step) : caretMoved(state, step);
|
|
15606
|
-
};
|
|
15607
|
-
caretFor = (state, key) => {
|
|
15608
|
-
const sideways = caretSideways(state, key);
|
|
15609
|
-
if (sideways !== void 0) return sideways;
|
|
15610
|
-
const word = byWord(key) ? WORD_STEP[key.name] : void 0;
|
|
15611
|
-
if (word !== void 0) return caretJumped(state, word);
|
|
15612
|
-
if (key.name === "home") return caretHomed(state, "start");
|
|
15613
|
-
if (key.name === "end") return caretHomed(state, "end");
|
|
15614
|
-
return key.name === "delete" ? deleted(state) : void 0;
|
|
15615
|
-
};
|
|
15616
|
-
erasedBy = (state, key) => {
|
|
15617
|
-
if (key.meta || key.ctrl) return lineBackspaced(state);
|
|
15618
|
-
return key.option ? wordBackspaced(state) : backspaced(state);
|
|
15619
|
-
};
|
|
15620
15586
|
LISTENS = /* @__PURE__ */ new Set(["keys", "palette"]);
|
|
15587
|
+
WRITES = /* @__PURE__ */ new Set(["compose", "report"]);
|
|
15588
|
+
writesInto = (screen) => WRITES.has(screen);
|
|
15621
15589
|
listens = (screen) => LISTENS.has(screen);
|
|
15622
15590
|
laidOut = (key) => key.baseCode === void 0 || key.name.length !== 1 ? key.name : String.fromCodePoint(key.baseCode);
|
|
15623
15591
|
ARROWS = /* @__PURE__ */ new Set([
|
|
@@ -15647,6 +15615,7 @@ var init_app = __esmMin((() => {
|
|
|
15647
15615
|
remembered = "";
|
|
15648
15616
|
wrapKept = false;
|
|
15649
15617
|
stickyKept = true;
|
|
15618
|
+
grewWithShift = false;
|
|
15650
15619
|
keys = [];
|
|
15651
15620
|
trail = [];
|
|
15652
15621
|
began = Date.now();
|
|
@@ -15675,8 +15644,10 @@ var init_app = __esmMin((() => {
|
|
|
15675
15644
|
onRail: (delta) => this.dispatchTask(this.rolled(delta))
|
|
15676
15645
|
}));
|
|
15677
15646
|
renderer.on("selection", () => this.copyDragged());
|
|
15647
|
+
runSync(options.display.onWritten((text) => this.readBack(text)));
|
|
15648
|
+
runSync(options.display.onAsked((text) => this.askedBack(text)));
|
|
15678
15649
|
renderer.keyInput.on("keypress", (key) => this.dispatch(key));
|
|
15679
|
-
renderer.keyInput.on("
|
|
15650
|
+
renderer.keyInput.on("keyrelease", (key) => this.letGo(key));
|
|
15680
15651
|
renderer.on("destroy", () => this.stopWatching());
|
|
15681
15652
|
renderer.on("destroy", () => this.stopFading());
|
|
15682
15653
|
renderer.on("destroy", () => this.stopLighting());
|
|
@@ -15727,7 +15698,6 @@ var init_app = __esmMin((() => {
|
|
|
15727
15698
|
answer(intent) {
|
|
15728
15699
|
return Intent.$match(intent, {
|
|
15729
15700
|
Key: ({ key }) => this.onKey(key),
|
|
15730
|
-
Paste: ({ text }) => sync(() => this.onPaste(text)),
|
|
15731
15701
|
Task: ({ run }) => run,
|
|
15732
15702
|
Ping: ({ done }) => asVoid(succeed$3(done, void 0))
|
|
15733
15703
|
});
|
|
@@ -15770,15 +15740,17 @@ var init_app = __esmMin((() => {
|
|
|
15770
15740
|
runFork(writeSession(this.sessionPath, session));
|
|
15771
15741
|
}
|
|
15772
15742
|
dispatch(key) {
|
|
15743
|
+
if (key.eventType === "release") {
|
|
15744
|
+
this.letGo(key);
|
|
15745
|
+
return;
|
|
15746
|
+
}
|
|
15773
15747
|
if (this.renderer.hasSelection) this.renderer.clearSelection();
|
|
15774
15748
|
offerUnsafe(this.intents, Intent.Key({ key }));
|
|
15775
15749
|
}
|
|
15776
|
-
|
|
15777
|
-
|
|
15778
|
-
|
|
15779
|
-
|
|
15780
|
-
if (!takesText(this.state.screen)) return;
|
|
15781
|
-
this.commit(pasted(this.state, text));
|
|
15750
|
+
letGo(key) {
|
|
15751
|
+
if (!key.name.endsWith("shift") || !this.grewWithShift) return;
|
|
15752
|
+
this.grewWithShift = false;
|
|
15753
|
+
offerUnsafe(this.intents, Intent.Key({ key: asKey("c") }));
|
|
15782
15754
|
}
|
|
15783
15755
|
fail(cause) {
|
|
15784
15756
|
this.failure = cause instanceof Error ? `${cause.message}\n${cause.stack ?? ""}` : String(cause);
|
|
@@ -15786,11 +15758,22 @@ var init_app = __esmMin((() => {
|
|
|
15786
15758
|
lastFailure() {
|
|
15787
15759
|
return this.failure;
|
|
15788
15760
|
}
|
|
15789
|
-
|
|
15790
|
-
if (this.consuming === void 0) return Promise.resolve();
|
|
15761
|
+
pinged() {
|
|
15791
15762
|
const done = makeUnsafe$4();
|
|
15792
15763
|
offerUnsafe(this.intents, Intent.Ping({ done }));
|
|
15793
|
-
return
|
|
15764
|
+
return _await(done);
|
|
15765
|
+
}
|
|
15766
|
+
drained() {
|
|
15767
|
+
return gen({ self: this }, function* () {
|
|
15768
|
+
for (let pass = 0; pass < DRAIN_PASSES; pass += 1) {
|
|
15769
|
+
yield* this.pinged();
|
|
15770
|
+
if (sizeUnsafe(this.intents) === 0) return;
|
|
15771
|
+
}
|
|
15772
|
+
});
|
|
15773
|
+
}
|
|
15774
|
+
settled() {
|
|
15775
|
+
if (this.consuming === void 0) return Promise.resolve();
|
|
15776
|
+
return runPromise(andThen(this.drained(), this.stillLighting()));
|
|
15794
15777
|
}
|
|
15795
15778
|
stillLighting() {
|
|
15796
15779
|
const fiber = this.lighting;
|
|
@@ -15879,6 +15862,7 @@ var init_app = __esmMin((() => {
|
|
|
15879
15862
|
}
|
|
15880
15863
|
commit(given) {
|
|
15881
15864
|
const next = given.patchIndex === this.state.patchIndex ? given : turnedOver(given);
|
|
15865
|
+
this.turnWriting(next);
|
|
15882
15866
|
const appeared = next.notice.length > 0 && next.notice !== this.state.notice;
|
|
15883
15867
|
if (appeared) this.recordNotice(next.notice);
|
|
15884
15868
|
this.rememberPlace(next);
|
|
@@ -15983,6 +15967,7 @@ var init_app = __esmMin((() => {
|
|
|
15983
15967
|
onKey(key, forced) {
|
|
15984
15968
|
return gen({ self: this }, function* () {
|
|
15985
15969
|
const action = forced ?? actionFor(this.state.screen, keyName(key), this.state.focus);
|
|
15970
|
+
this.grewWithShift = action === "select.grow" || action === "select.shrink";
|
|
15986
15971
|
this.remember(action, key);
|
|
15987
15972
|
if (action === void 0) {
|
|
15988
15973
|
this.onText(key);
|
|
@@ -15997,30 +15982,38 @@ var init_app = __esmMin((() => {
|
|
|
15997
15982
|
});
|
|
15998
15983
|
}
|
|
15999
15984
|
onText(key) {
|
|
16000
|
-
if (!
|
|
16001
|
-
if (key.name === "
|
|
16002
|
-
|
|
15985
|
+
if (!listens(this.state.screen)) return;
|
|
15986
|
+
if (key.name === "down" || key.name === "up") this.commit(paletteMoved(this.state, key.name === "down" ? 1 : -1));
|
|
15987
|
+
}
|
|
15988
|
+
turnWriting(next) {
|
|
15989
|
+
if (listens(next.screen) !== listens(this.state.screen) || next.screen !== this.state.screen) runSync(this.display.askOn(listens(next.screen) ? next.screen : void 0));
|
|
15990
|
+
const was = writesInto(this.state.screen);
|
|
15991
|
+
const now = writesInto(next.screen);
|
|
15992
|
+
if (was === now) return;
|
|
15993
|
+
if (now) runSync(this.display.write(next.draft));
|
|
15994
|
+
runSync(this.display.writeOn(now));
|
|
15995
|
+
}
|
|
15996
|
+
askedBack(text) {
|
|
15997
|
+
const clean = legible(text).replaceAll("\n", " ");
|
|
15998
|
+
if (clean !== text) {
|
|
15999
|
+
runSync(this.display.askWith(clean));
|
|
16003
16000
|
return;
|
|
16004
16001
|
}
|
|
16005
|
-
if (
|
|
16006
|
-
|
|
16002
|
+
if (!listens(this.state.screen) || clean === this.state.query) return;
|
|
16003
|
+
this.commit({
|
|
16004
|
+
...this.state,
|
|
16005
|
+
query: clean,
|
|
16006
|
+
paletteIndex: 0
|
|
16007
|
+
});
|
|
16008
|
+
}
|
|
16009
|
+
readBack(text) {
|
|
16010
|
+
const clean = legible(stripAnsiSequences(text));
|
|
16011
|
+
if (clean !== text) {
|
|
16012
|
+
runSync(this.display.write(clean));
|
|
16007
16013
|
return;
|
|
16008
16014
|
}
|
|
16009
|
-
if (this.
|
|
16010
|
-
|
|
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
|
-
}
|
|
16018
|
-
onCaret(key) {
|
|
16019
|
-
if (this.state.screen === "palette" || this.state.screen === "keys") return false;
|
|
16020
|
-
const moved = caretFor(this.state, key);
|
|
16021
|
-
if (moved === void 0) return false;
|
|
16022
|
-
this.commit(moved);
|
|
16023
|
-
return true;
|
|
16015
|
+
if (text === this.state.draft) return;
|
|
16016
|
+
this.commit(withDraft(this.state, text));
|
|
16024
16017
|
}
|
|
16025
16018
|
runChoice() {
|
|
16026
16019
|
return gen({ self: this }, function* () {
|
|
@@ -16064,11 +16057,6 @@ var init_app = __esmMin((() => {
|
|
|
16064
16057
|
}
|
|
16065
16058
|
copyDragged() {
|
|
16066
16059
|
const taken = this.renderer.getSelection()?.getSelectedText() ?? "";
|
|
16067
|
-
const where = process.env["ADIFF_TRACE"];
|
|
16068
|
-
if (where !== void 0) {
|
|
16069
|
-
const holder = this.renderer.getSelectionContainer()?.id ?? "none";
|
|
16070
|
-
appendFileSync(where, `${this.state.screen} in=${holder} ${JSON.stringify(taken).slice(0, 70)}\n`);
|
|
16071
|
-
}
|
|
16072
16060
|
if (taken.trim().length === 0) return;
|
|
16073
16061
|
copyToClipboard(taken);
|
|
16074
16062
|
const lines = taken.split("\n").length;
|
|
@@ -16559,7 +16547,10 @@ var init_app = __esmMin((() => {
|
|
|
16559
16547
|
yield* untilDestroyed(renderer);
|
|
16560
16548
|
});
|
|
16561
16549
|
runTui = fn("Tui.run")(function* (repo, sessionPath, branch) {
|
|
16562
|
-
const renderer = yield* promise(() => createCliRenderer({
|
|
16550
|
+
const renderer = yield* promise(() => createCliRenderer({
|
|
16551
|
+
exitOnCtrlC: true,
|
|
16552
|
+
useKittyKeyboard: { events: true }
|
|
16553
|
+
}));
|
|
16563
16554
|
yield* runOn(repo, renderer, sessionPath, branch);
|
|
16564
16555
|
});
|
|
16565
16556
|
}));
|
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.
|
|
26
|
+
"version": "0.1.0-alpha.76",
|
|
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": {
|