@eliya-oss/agent-diff 0.1.0-alpha.57 → 0.1.0-alpha.59
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 +20 -0
- package/dist/main.js +313 -69
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @eliya-oss/agent-diff
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.59
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- An answer stays unread until you open it, and the count survives reloading the branch. Keys work on a keyboard that is not English: a binding matches the key the letter sits on. Bug reports carry the last twenty moves, and `ctrl+t` sends only the words you typed.
|
|
8
|
+
|
|
9
|
+
## 0.1.0-alpha.58
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Syntax colour is read from the file now, not from the diff. The visible rows were handed to the parser as if they were a document, so a hunk starting inside a JSX block or an object literal gave it no opening to find, and the gap and comment rows between hunks were fed to it as code — which is why colour looked right in some files and wrong in others. Both sides of the file are parsed whole and the colours laid onto the rows that show them.
|
|
14
|
+
|
|
15
|
+
Three things around the diff were fixed with it. The pinned scope no longer keeps the previous file's line: the memo that skips redrawing an unchanged pin was reset without the pin being cleared, so an empty chain skipped the redraw and left the old scope on screen. Scrolling a deeply indented file no longer jumps, because the rows available to scroll through no longer shrink and grow with the pinned scope under the cursor. And `option` and `command` with backspace take back a word and a line while writing a comment, rather than one character like a bare backspace.
|
|
16
|
+
|
|
17
|
+
`}` and `{` walk changes rather than hunks. They jumped to the top of a hunk, which is its leading context, so the cursor landed three lines short of the thing it was jumping to — and with the whole file shown there was only ever one hunk, so they stopped working entirely. They now step from one run of changed lines to the next, which works at any width and lands on the change.
|
|
18
|
+
|
|
19
|
+
Opening a comment from the review panel brings the diff to it. The row was worked out from the diff before its gap and comment rows were counted in, so it landed somewhere else in the file — often the end. A comment whose line is not in the diff at all says so rather than moving you somewhere arbitrary.
|
|
20
|
+
|
|
21
|
+
The review screen also uses the two rows it was leaving empty above and below itself.
|
|
22
|
+
|
|
3
23
|
## 0.1.0-alpha.57
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/main.js
CHANGED
|
@@ -8019,7 +8019,7 @@ var init_run = __esmMin((() => {
|
|
|
8019
8019
|
}));
|
|
8020
8020
|
//#endregion
|
|
8021
8021
|
//#region src/service/git/service.ts
|
|
8022
|
-
var GREP_CONTEXT, DEFAULT_BRANCH_CANDIDATES, STAT, Git, parseStat, readEntries, baseNames, mergeBases, findDefaultBranch, defaultBranch, mergeBaseOf, toWorktree, branchTips, parents, parentOf, splitLines, absent, readText, settled, listWorktrees, readDiff, readStat, readSource, readGrep, shape, GitLive;
|
|
8022
|
+
var GREP_CONTEXT, DEFAULT_BRANCH_CANDIDATES, STAT, Git, parseStat, readEntries, baseNames, mergeBases, findDefaultBranch, defaultBranch, mergeBaseOf, toWorktree, branchTips, parents, parentOf, splitLines, absent, readText, settled, listWorktrees, readDiff, readStat, readSource, readBlob, readGrep, shape, GitLive;
|
|
8023
8023
|
var init_service$2 = __esmMin((() => {
|
|
8024
8024
|
init_dist();
|
|
8025
8025
|
init_error$3();
|
|
@@ -8178,6 +8178,11 @@ var init_service$2 = __esmMin((() => {
|
|
|
8178
8178
|
const text = yield* readText(join(worktree.path, path), path);
|
|
8179
8179
|
return map$4(text, splitLines);
|
|
8180
8180
|
});
|
|
8181
|
+
readBlob = fn("Git.blob")(function* (worktree, path) {
|
|
8182
|
+
const target = worktree.base.length > 0 ? worktree.base : "HEAD";
|
|
8183
|
+
const raw = yield* gitOrEmpty(worktree.path, ["show", `${target}:${path}`]);
|
|
8184
|
+
return raw.length === 0 ? none() : some(splitLines(raw));
|
|
8185
|
+
});
|
|
8181
8186
|
readGrep = fn("Git.grep")(function* (worktree, term) {
|
|
8182
8187
|
return yield* gitOrEmpty(worktree.path, [
|
|
8183
8188
|
"grep",
|
|
@@ -8205,6 +8210,7 @@ var init_service$2 = __esmMin((() => {
|
|
|
8205
8210
|
diff: readDiff,
|
|
8206
8211
|
stat: readStat,
|
|
8207
8212
|
source: readSource,
|
|
8213
|
+
blob: readBlob,
|
|
8208
8214
|
grep: readGrep,
|
|
8209
8215
|
defaultBranch,
|
|
8210
8216
|
stackParent: (repo, branch) => defaultBranch(repo).pipe(flatMap((fallback) => parentOf(repo, branch, fallback))),
|
|
@@ -8294,7 +8300,8 @@ var init_model$2 = __esmMin((() => {
|
|
|
8294
8300
|
pending: [],
|
|
8295
8301
|
settled: {},
|
|
8296
8302
|
removed: {},
|
|
8297
|
-
base: ""
|
|
8303
|
+
base: "",
|
|
8304
|
+
read: {}
|
|
8298
8305
|
};
|
|
8299
8306
|
}));
|
|
8300
8307
|
//#endregion
|
|
@@ -8335,7 +8342,8 @@ var init_schema = __esmMin((() => {
|
|
|
8335
8342
|
pending: optionalKey(ArraySchema(StoredComment)),
|
|
8336
8343
|
settled: optionalKey(Record(String$1, String$1)),
|
|
8337
8344
|
removed: optionalKey(Record(String$1, String$1)),
|
|
8338
|
-
base: optionalKey(String$1)
|
|
8345
|
+
base: optionalKey(String$1),
|
|
8346
|
+
read: optionalKey(Record(String$1, Int))
|
|
8339
8347
|
});
|
|
8340
8348
|
Settings = Struct({ wrap: optionalKey(Boolean) });
|
|
8341
8349
|
UpgradeCheck = Struct({
|
|
@@ -8741,7 +8749,7 @@ var init_error$1 = __esmMin((() => {
|
|
|
8741
8749
|
}));
|
|
8742
8750
|
//#endregion
|
|
8743
8751
|
//#region src/cli/commands.ts
|
|
8744
|
-
var CONTEXT, WHOLE_FILE$1, POLL, AUTO, askedFor, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, rowsCovering, waitingOn, listBranches, blobOf, toggleVouch, reviewProgress, anchorRequest, stageComment, editStaged, dropStaged, listPending, bodyOf, sentOf, listSent, submitReview, submitComment, listPatches, flatten, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, saveWrap, setBase, clearBase;
|
|
8752
|
+
var CONTEXT, WHOLE_FILE$1, POLL, AUTO, askedFor, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, rowsCovering, waitingOn, listBranches, blobOf, toggleVouch, reviewProgress, anchorRequest, stageComment, editStaged, dropStaged, listPending, bodyOf, sentOf, listSent, submitReview, submitComment, listPatches, flatten, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, saveWrap, setBase, clearBase, markRead;
|
|
8745
8753
|
var init_commands = __esmMin((() => {
|
|
8746
8754
|
init_dist();
|
|
8747
8755
|
init_patch();
|
|
@@ -8988,7 +8996,7 @@ var init_commands = __esmMin((() => {
|
|
|
8988
8996
|
});
|
|
8989
8997
|
bodyOf = (entry) => entry.body;
|
|
8990
8998
|
sentOf = (comment, reading) => {
|
|
8991
|
-
const { spoken, settled, head, shown } = reading;
|
|
8999
|
+
const { spoken, settled, head, shown, read } = reading;
|
|
8992
9000
|
const mine = spoken.filter((entry) => entry.comment === comment.id);
|
|
8993
9001
|
return {
|
|
8994
9002
|
id: comment.id,
|
|
@@ -9000,6 +9008,7 @@ var init_commands = __esmMin((() => {
|
|
|
9000
9008
|
settled: Object.hasOwn(settled, comment.id),
|
|
9001
9009
|
stale: comment.head !== head,
|
|
9002
9010
|
outside: !shown.has(comment.file),
|
|
9011
|
+
unread: Math.max(0, mine.length - (read[comment.id] ?? 0)),
|
|
9003
9012
|
asks: mine.at(-1)?.asks === true,
|
|
9004
9013
|
answers: mine.map(bodyOf)
|
|
9005
9014
|
};
|
|
@@ -9014,7 +9023,8 @@ var init_commands = __esmMin((() => {
|
|
|
9014
9023
|
spoken,
|
|
9015
9024
|
settled: current.settled,
|
|
9016
9025
|
head: worktree.head,
|
|
9017
|
-
shown
|
|
9026
|
+
shown,
|
|
9027
|
+
read: current.read
|
|
9018
9028
|
}));
|
|
9019
9029
|
});
|
|
9020
9030
|
submitReview = fn("Cli.submitReview")(function* (repo, branch, id, at) {
|
|
@@ -9119,6 +9129,12 @@ var init_commands = __esmMin((() => {
|
|
|
9119
9129
|
const found = yield* git.source(worktree, file);
|
|
9120
9130
|
return getOrElse(found, () => []);
|
|
9121
9131
|
});
|
|
9132
|
+
fileBefore = fn("Cli.fileBefore")(function* (repo, branch, file) {
|
|
9133
|
+
const git = yield* Git;
|
|
9134
|
+
const worktree = yield* findBranch(repo, branch);
|
|
9135
|
+
const found = yield* git.blob(worktree, file);
|
|
9136
|
+
return getOrElse(found, () => []);
|
|
9137
|
+
});
|
|
9122
9138
|
saveWrap = fn("Cli.saveWrap")(function* (wrap) {
|
|
9123
9139
|
const store = yield* Store;
|
|
9124
9140
|
const current = yield* store.settings;
|
|
@@ -9156,6 +9172,27 @@ var init_commands = __esmMin((() => {
|
|
|
9156
9172
|
basis: based.basis
|
|
9157
9173
|
};
|
|
9158
9174
|
});
|
|
9175
|
+
markRead = fn("Cli.markRead")(function* (repo, branch, id) {
|
|
9176
|
+
const store = yield* Store;
|
|
9177
|
+
const worktree = yield* findBranch(repo, branch);
|
|
9178
|
+
const seen = (yield* store.answers(worktree.path)).filter((entry) => entry.comment === id).length;
|
|
9179
|
+
const current = yield* store.state(worktree.path);
|
|
9180
|
+
if ((current.read[id] ?? 0) >= seen) return {
|
|
9181
|
+
id,
|
|
9182
|
+
unread: 0
|
|
9183
|
+
};
|
|
9184
|
+
yield* store.saveState(worktree.path, {
|
|
9185
|
+
...current,
|
|
9186
|
+
read: {
|
|
9187
|
+
...current.read,
|
|
9188
|
+
[id]: seen
|
|
9189
|
+
}
|
|
9190
|
+
});
|
|
9191
|
+
return {
|
|
9192
|
+
id,
|
|
9193
|
+
unread: 0
|
|
9194
|
+
};
|
|
9195
|
+
});
|
|
9159
9196
|
}));
|
|
9160
9197
|
//#endregion
|
|
9161
9198
|
//#region src/cli/init.ts
|
|
@@ -9411,7 +9448,7 @@ var init_pane = __esmMin((() => {
|
|
|
9411
9448
|
init_commands();
|
|
9412
9449
|
init_init();
|
|
9413
9450
|
init_pane();
|
|
9414
|
-
var version$1 = "0.1.0-alpha.
|
|
9451
|
+
var version$1 = "0.1.0-alpha.59";
|
|
9415
9452
|
//#endregion
|
|
9416
9453
|
//#region src/cli/upgrade.ts
|
|
9417
9454
|
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;
|
|
@@ -10011,6 +10048,7 @@ var init_threads = __esmMin((() => {
|
|
|
10011
10048
|
state: stateOf$1(mine, Object.hasOwn(reading.settled, comment.id), Object.hasOwn(reading.removed, comment.id)),
|
|
10012
10049
|
stale: batch.head !== reading.head,
|
|
10013
10050
|
outside: !reading.shown.has(comment.anchor.path),
|
|
10051
|
+
unread: Math.max(0, mine.length - (reading.read[comment.id] ?? 0)),
|
|
10014
10052
|
answers: mine.map(spoken$1)
|
|
10015
10053
|
};
|
|
10016
10054
|
};
|
|
@@ -10030,6 +10068,7 @@ var init_threads = __esmMin((() => {
|
|
|
10030
10068
|
state: "staged",
|
|
10031
10069
|
stale: false,
|
|
10032
10070
|
outside: false,
|
|
10071
|
+
unread: 0,
|
|
10033
10072
|
answers: []
|
|
10034
10073
|
});
|
|
10035
10074
|
listThreads = fn("Cli.listThreads")(function* (repo, branch, base) {
|
|
@@ -10041,7 +10080,8 @@ var init_threads = __esmMin((() => {
|
|
|
10041
10080
|
settled: current.settled,
|
|
10042
10081
|
removed: current.removed,
|
|
10043
10082
|
head: worktree.head,
|
|
10044
|
-
shown: new Set((yield* patchesOf(worktree)).map((patch) => patch.path))
|
|
10083
|
+
shown: new Set((yield* patchesOf(worktree)).map((patch) => patch.path)),
|
|
10084
|
+
read: current.read
|
|
10045
10085
|
}), ...current.pending.map(stagedOf)];
|
|
10046
10086
|
});
|
|
10047
10087
|
answerComment = fn("Cli.answerComment")(function* (request) {
|
|
@@ -11183,7 +11223,7 @@ var init_tree = __esmMin((() => {
|
|
|
11183
11223
|
return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
|
|
11184
11224
|
};
|
|
11185
11225
|
crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
|
|
11186
|
-
})), 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, treeOf, treeRows, crowdedOf, foldersOfFile, isReviewed, treeWindow, commentsOn, hiddenLines, markedRows, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, caretAt, drafted, WORD, wordLeft, wordRight, caretByWord, lineStart, lineEnd, caretToEdge, editedComment, composeTarget, selectedLines, KEYWORDS, NAME, longestName$1, searchTerm, matchHere, selectionReadout, WHOLE_FILE, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, answersIn, newerOf, sectionOf, sentEntry, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, changeAround, nextUnreviewed, reviewedCount, fileOrder, layerFile, selectionRange;
|
|
11226
|
+
})), 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, treeOf, treeRows, crowdedOf, foldersOfFile, isReviewed, treeWindow, commentsOn, hiddenLines, markedRows, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, caretAt, drafted, WORD, wordLeft, wordRight, caretByWord, lineStart, lineEnd, caretToEdge, editedComment, composeTarget, selectedLines, KEYWORDS, NAME, longestName$1, searchTerm, matchHere, selectionReadout, WHOLE_FILE, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, answersIn, newerOf, sectionOf, sentEntry, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, changeAround, nextUnreviewed, reviewedCount, fileOrder, layerFile, selectionRange;
|
|
11187
11227
|
var init_model = __esmMin((() => {
|
|
11188
11228
|
init_dist();
|
|
11189
11229
|
init_patch();
|
|
@@ -11194,7 +11234,8 @@ var init_model = __esmMin((() => {
|
|
|
11194
11234
|
panelOpen: true,
|
|
11195
11235
|
panelWas: true,
|
|
11196
11236
|
panelIndex: 0,
|
|
11197
|
-
columns: 0
|
|
11237
|
+
columns: 0,
|
|
11238
|
+
reportFull: true
|
|
11198
11239
|
};
|
|
11199
11240
|
initialState = (branches) => ({
|
|
11200
11241
|
...nothingReviewed,
|
|
@@ -11570,6 +11611,10 @@ var init_model = __esmMin((() => {
|
|
|
11570
11611
|
onSome: (value) => value >= line
|
|
11571
11612
|
}))?.index ?? 0;
|
|
11572
11613
|
};
|
|
11614
|
+
rowShowing = (patch, line) => patch.rows.find((row) => match$3(row.newLine, {
|
|
11615
|
+
onNone: () => false,
|
|
11616
|
+
onSome: (value) => value === line
|
|
11617
|
+
}))?.index;
|
|
11573
11618
|
lineOnSide = (row, side) => getOrUndefined$1(side === "old" ? row.oldLine : row.newLine);
|
|
11574
11619
|
commentRowsIn = (state, fileIndex) => {
|
|
11575
11620
|
const patch = fileIndex === state.patchIndex ? selectedPatch(state) : state.patches[fileIndex];
|
|
@@ -11612,14 +11657,16 @@ var init_model = __esmMin((() => {
|
|
|
11612
11657
|
return {
|
|
11613
11658
|
section: sectionOf(newer),
|
|
11614
11659
|
comment: newer,
|
|
11615
|
-
fresh: newer !== comment
|
|
11660
|
+
fresh: newer !== comment,
|
|
11661
|
+
unread: newer.unread ?? 0
|
|
11616
11662
|
};
|
|
11617
11663
|
};
|
|
11618
11664
|
panelEntries = (state) => {
|
|
11619
11665
|
const staged = state.pending.map((comment) => ({
|
|
11620
11666
|
section: "staged",
|
|
11621
11667
|
comment,
|
|
11622
|
-
fresh: false
|
|
11668
|
+
fresh: false,
|
|
11669
|
+
unread: 0
|
|
11623
11670
|
}));
|
|
11624
11671
|
const delivered = state.sent.map((comment) => sentEntry(state, comment));
|
|
11625
11672
|
return [
|
|
@@ -11636,8 +11683,15 @@ var init_model = __esmMin((() => {
|
|
|
11636
11683
|
};
|
|
11637
11684
|
spokenSince = (seen, now) => Math.max(0, answerCount(now) - answerCount(seen));
|
|
11638
11685
|
hunkStarts = (state) => {
|
|
11639
|
-
const
|
|
11640
|
-
|
|
11686
|
+
const rows = selectedPatch(state)?.rows ?? [];
|
|
11687
|
+
const starts = [];
|
|
11688
|
+
let running = false;
|
|
11689
|
+
for (const [index, row] of rows.entries()) {
|
|
11690
|
+
const changed = row.kind !== "context";
|
|
11691
|
+
if (changed && !running) starts.push(index);
|
|
11692
|
+
running = changed;
|
|
11693
|
+
}
|
|
11694
|
+
return starts;
|
|
11641
11695
|
};
|
|
11642
11696
|
changeAround = (state) => {
|
|
11643
11697
|
const rows = selectedPatch(state)?.rows ?? [];
|
|
@@ -11669,7 +11723,7 @@ var init_model = __esmMin((() => {
|
|
|
11669
11723
|
}));
|
|
11670
11724
|
//#endregion
|
|
11671
11725
|
//#region src/tui/report.ts
|
|
11672
|
-
var AROUND_CURSOR, TREE_ROWS, sign, visibleRows, visibleTree, facts, buildReport;
|
|
11726
|
+
var AROUND_CURSOR, TREE_ROWS, sign, visibleRows, visibleTree, facts, fenced, fully, minimal, buildReport;
|
|
11673
11727
|
var init_report = __esmMin((() => {
|
|
11674
11728
|
init_model();
|
|
11675
11729
|
AROUND_CURSOR = 8;
|
|
@@ -11695,6 +11749,21 @@ var init_report = __esmMin((() => {
|
|
|
11695
11749
|
`- screen \`${state.screen}\`, focus \`${state.focus}\`, selecting ${String(state.selecting)}`,
|
|
11696
11750
|
`- ${state.staged} staged, ${state.vouched.length} of ${state.patches.length} reviewed`
|
|
11697
11751
|
];
|
|
11752
|
+
fenced = (title, lines) => [
|
|
11753
|
+
`## ${title}`,
|
|
11754
|
+
"",
|
|
11755
|
+
"```",
|
|
11756
|
+
...lines,
|
|
11757
|
+
"```",
|
|
11758
|
+
""
|
|
11759
|
+
];
|
|
11760
|
+
fully = (state, around) => [
|
|
11761
|
+
...fenced("What led here", around.trail),
|
|
11762
|
+
...fenced("Keys pressed", [around.keys.join(" ")]),
|
|
11763
|
+
...fenced("Files", visibleTree(state)),
|
|
11764
|
+
...fenced("Around the cursor", visibleRows(state))
|
|
11765
|
+
];
|
|
11766
|
+
minimal = () => ["_Sent as a minimal report: no file names, no code, no key history._", ""];
|
|
11698
11767
|
buildReport = (state, around) => {
|
|
11699
11768
|
const failure = around.failure.length === 0 ? "none" : around.failure.split("\n")[0];
|
|
11700
11769
|
return [
|
|
@@ -11707,24 +11776,7 @@ var init_report = __esmMin((() => {
|
|
|
11707
11776
|
...facts(state, around),
|
|
11708
11777
|
`- last internal failure: ${failure}`,
|
|
11709
11778
|
"",
|
|
11710
|
-
|
|
11711
|
-
"",
|
|
11712
|
-
"```",
|
|
11713
|
-
around.keys.join(" "),
|
|
11714
|
-
"```",
|
|
11715
|
-
"",
|
|
11716
|
-
"## Files",
|
|
11717
|
-
"",
|
|
11718
|
-
"```",
|
|
11719
|
-
...visibleTree(state),
|
|
11720
|
-
"```",
|
|
11721
|
-
"",
|
|
11722
|
-
"## Around the cursor",
|
|
11723
|
-
"",
|
|
11724
|
-
"```",
|
|
11725
|
-
...visibleRows(state),
|
|
11726
|
-
"```",
|
|
11727
|
-
""
|
|
11779
|
+
...state.reportFull ? fully(state, around) : minimal()
|
|
11728
11780
|
].join("\n");
|
|
11729
11781
|
};
|
|
11730
11782
|
}));
|
|
@@ -12116,6 +12168,14 @@ var init_command = __esmMin((() => {
|
|
|
12116
12168
|
keys: ["ctrl+b"],
|
|
12117
12169
|
screens: ["branches", "review"]
|
|
12118
12170
|
}),
|
|
12171
|
+
command({
|
|
12172
|
+
action: "report.mode",
|
|
12173
|
+
title: "Send a minimal report instead of a full one",
|
|
12174
|
+
category: "General",
|
|
12175
|
+
keys: ["ctrl+t"],
|
|
12176
|
+
screens: ["report"],
|
|
12177
|
+
listed: false
|
|
12178
|
+
}),
|
|
12119
12179
|
command({
|
|
12120
12180
|
action: "report.send",
|
|
12121
12181
|
title: "Send the report",
|
|
@@ -12335,7 +12395,7 @@ var init_match = __esmMin((() => {
|
|
|
12335
12395
|
}));
|
|
12336
12396
|
//#endregion
|
|
12337
12397
|
//#region src/tui/reduce.ts
|
|
12338
|
-
var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, draggedTo, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, movePending, moveLayer, inRail, 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, offered, paletteChoice, transitions, reduce, atFile, withContext, withFull, revealsAfter, gapOpened, withPending, panBy, withSent, withArrived, withColumns, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, withPatches, inserted, typed, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, pasted, backspaced, deleted, caretMoved, caretJumped, caretHomed, withDraft, paletteMoved, paletteClosed, withWaiting, withMatches, withNoticeHere, withNotice;
|
|
12398
|
+
var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, draggedTo, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, movePending, moveLayer, inRail, 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, offered, paletteChoice, transitions, reduce, atFile, withContext, withFull, revealsAfter, gapOpened, withPending, panBy, withSent, withArrived, withColumns, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, openedAt, withPatches, inserted, typed, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, pasted, backspaced, cutBackTo, wordBackspaced, lineBackspaced, deleted, caretMoved, caretJumped, caretHomed, withDraft, paletteMoved, paletteClosed, withWaiting, withMatches, withNoticeHere, withNotice;
|
|
12339
12399
|
var init_reduce = __esmMin((() => {
|
|
12340
12400
|
init_dist();
|
|
12341
12401
|
init_patch();
|
|
@@ -12401,8 +12461,8 @@ var init_reduce = __esmMin((() => {
|
|
|
12401
12461
|
cursor: clamp(row, 0, lastRow(selectedPatch(state)))
|
|
12402
12462
|
});
|
|
12403
12463
|
noneLeft = (state, delta) => {
|
|
12404
|
-
const
|
|
12405
|
-
return withNotice(state,
|
|
12464
|
+
const none = hunkStarts(state).length === 0;
|
|
12465
|
+
return withNotice(state, none ? "nothing changed in this file" : `no change ${delta > 0 ? "after" : "before"} this one`);
|
|
12406
12466
|
};
|
|
12407
12467
|
layerHunk = (state, delta) => {
|
|
12408
12468
|
const starts = hunkStarts(state);
|
|
@@ -12726,6 +12786,10 @@ var init_reduce = __esmMin((() => {
|
|
|
12726
12786
|
"review.reload": (state) => state,
|
|
12727
12787
|
"thread.settle": (state) => state,
|
|
12728
12788
|
"thread.remove": (state) => state,
|
|
12789
|
+
"report.mode": (state) => ({
|
|
12790
|
+
...state,
|
|
12791
|
+
reportFull: !state.reportFull
|
|
12792
|
+
}),
|
|
12729
12793
|
"rail.toggle": toggleRail,
|
|
12730
12794
|
"file.vouch": (state) => state,
|
|
12731
12795
|
"file.vouch.next": (state) => state,
|
|
@@ -12877,6 +12941,29 @@ var init_reduce = __esmMin((() => {
|
|
|
12877
12941
|
top
|
|
12878
12942
|
});
|
|
12879
12943
|
};
|
|
12944
|
+
openedAt = (state, patchIndex, line) => {
|
|
12945
|
+
const landed = {
|
|
12946
|
+
...state,
|
|
12947
|
+
patchIndex,
|
|
12948
|
+
stop: 0,
|
|
12949
|
+
anchorRow: 0,
|
|
12950
|
+
selecting: false
|
|
12951
|
+
};
|
|
12952
|
+
const shown = selectedPatch(landed);
|
|
12953
|
+
if (shown === void 0) return {
|
|
12954
|
+
...landed,
|
|
12955
|
+
cursor: 0,
|
|
12956
|
+
top: 0
|
|
12957
|
+
};
|
|
12958
|
+
const cursor = rowShowing(shown, line) ?? rowAtSourceLine(shown, line);
|
|
12959
|
+
const height = Math.max(1, landed.viewport);
|
|
12960
|
+
const room = Math.max(0, shown.rows.length - height);
|
|
12961
|
+
return withCursorVisible({
|
|
12962
|
+
...landed,
|
|
12963
|
+
cursor,
|
|
12964
|
+
top: clamp(cursor - Math.floor(height / 2), 0, room)
|
|
12965
|
+
});
|
|
12966
|
+
};
|
|
12880
12967
|
withPatches = (state, patches) => ({
|
|
12881
12968
|
...state,
|
|
12882
12969
|
screen: "review",
|
|
@@ -12935,6 +13022,17 @@ var init_reduce = __esmMin((() => {
|
|
|
12935
13022
|
caret: at - 1
|
|
12936
13023
|
};
|
|
12937
13024
|
};
|
|
13025
|
+
cutBackTo = (state, to) => {
|
|
13026
|
+
const at = caretAt(state);
|
|
13027
|
+
if (to >= at) return state;
|
|
13028
|
+
return {
|
|
13029
|
+
...state,
|
|
13030
|
+
draft: `${state.draft.slice(0, to)}${state.draft.slice(at)}`,
|
|
13031
|
+
caret: to
|
|
13032
|
+
};
|
|
13033
|
+
};
|
|
13034
|
+
wordBackspaced = (state) => state.screen === "palette" ? backspaced(state) : cutBackTo(state, caretByWord(state, -1));
|
|
13035
|
+
lineBackspaced = (state) => state.screen === "palette" ? backspaced(state) : cutBackTo(state, caretToEdge(state, "start"));
|
|
12938
13036
|
deleted = (state) => {
|
|
12939
13037
|
const at = caretAt(state);
|
|
12940
13038
|
if (at >= state.draft.length) return state;
|
|
@@ -13154,7 +13252,7 @@ var init_theme = __esmMin((() => {
|
|
|
13154
13252
|
}));
|
|
13155
13253
|
//#endregion
|
|
13156
13254
|
//#region src/tui/diffview.ts
|
|
13157
|
-
var WASH, NOTE_MIN, ANSWER_MARK, OVERSCAN, SIGN_WIDTH, SCROLL_ROWS, PAN_COLUMNS, WAYS, notchesIn, wheelTo, SIGNS, numberFor, DiffView, startsOf, bareOf, keyOf, groupOf, isChrome, heldAt, textAt, noteSpans, NOTE_PAINT, wrap, headOf, spokenLines, answerLines, noteLines, noteRows, proseRows, proseAt, notesAt, codeRow, rowsFor, layout, lineNumbers, BARE_SIGN, signFor, lineSigns, sideLineOf;
|
|
13255
|
+
var WASH, NOTE_MIN, ANSWER_MARK, OVERSCAN, SIGN_WIDTH, SCROLL_ROWS, PAN_COLUMNS, WAYS, notchesIn, wheelTo, SIGNS, numberFor, DiffView, startsOf, bareOf, keyOf, groupOf, isChrome, heldAt, NO_SPANS, lineStarts, overLine, shifted, acrossLines, spansByLine, textAt, noteSpans, NOTE_PAINT, wrap, headOf, spokenLines, answerLines, noteLines, noteRows, proseRows, proseAt, notesAt, codeRow, rowsFor, layout, lineNumbers, BARE_SIGN, signFor, lineSigns, sideLineOf;
|
|
13158
13256
|
var init_diffview = __esmMin((() => {
|
|
13159
13257
|
init_dist();
|
|
13160
13258
|
init_patch();
|
|
@@ -13223,6 +13321,9 @@ var init_diffview = __esmMin((() => {
|
|
|
13223
13321
|
pinned;
|
|
13224
13322
|
pinBox;
|
|
13225
13323
|
pinnedText = "";
|
|
13324
|
+
newLit = [];
|
|
13325
|
+
oldLit = [];
|
|
13326
|
+
litFor = "";
|
|
13226
13327
|
shown;
|
|
13227
13328
|
noted = "";
|
|
13228
13329
|
display = [];
|
|
@@ -13287,6 +13388,12 @@ var init_diffview = __esmMin((() => {
|
|
|
13287
13388
|
gutterWidth() {
|
|
13288
13389
|
return Math.max(0, this.code.x - this.numbers.x) + SIGN_WIDTH;
|
|
13289
13390
|
}
|
|
13391
|
+
unpin() {
|
|
13392
|
+
this.pinnedText = "";
|
|
13393
|
+
this.pinned.content = "";
|
|
13394
|
+
this.pinned.height = 0;
|
|
13395
|
+
this.pinBox.height = 0;
|
|
13396
|
+
}
|
|
13290
13397
|
pin(lines) {
|
|
13291
13398
|
const indent = this.gutterWidth();
|
|
13292
13399
|
if (this.pinBox.paddingLeft !== indent) this.pinBox.paddingLeft = indent;
|
|
@@ -13332,7 +13439,7 @@ var init_diffview = __esmMin((() => {
|
|
|
13332
13439
|
const room = notes.length === 0 && prose.length === 0 ? NOTE_MIN : this.noteRoom();
|
|
13333
13440
|
const key = keyOf(room, notes, prose);
|
|
13334
13441
|
if (patch === this.shown && key === this.noted) return;
|
|
13335
|
-
this.
|
|
13442
|
+
this.unpin();
|
|
13336
13443
|
this.shown = patch;
|
|
13337
13444
|
this.noted = key;
|
|
13338
13445
|
this.display = layout({
|
|
@@ -13350,10 +13457,41 @@ var init_diffview = __esmMin((() => {
|
|
|
13350
13457
|
this.numbers.setLineSigns(lineSigns(patch, this.display));
|
|
13351
13458
|
this.numbers.setLineColors(/* @__PURE__ */ new Map());
|
|
13352
13459
|
}
|
|
13460
|
+
lit(path, side, lines, found) {
|
|
13461
|
+
const held = spansByLine(lines, found);
|
|
13462
|
+
if (side === "new") this.newLit = held;
|
|
13463
|
+
else this.oldLit = held;
|
|
13464
|
+
this.litFor = path;
|
|
13465
|
+
this.feed();
|
|
13466
|
+
this.code.requestRender();
|
|
13467
|
+
}
|
|
13468
|
+
litRow(entry) {
|
|
13469
|
+
if (this.shown === void 0 || this.shown.path !== this.litFor) return NO_SPANS;
|
|
13470
|
+
const row = this.shown.rows[entry.row];
|
|
13471
|
+
if (row === void 0) return NO_SPANS;
|
|
13472
|
+
const fresh = getOrUndefined$1(row.newLine);
|
|
13473
|
+
if (fresh !== void 0) return this.newLit[fresh - 1] ?? NO_SPANS;
|
|
13474
|
+
const gone = getOrUndefined$1(row.oldLine);
|
|
13475
|
+
return gone === void 0 ? NO_SPANS : this.oldLit[gone - 1] ?? NO_SPANS;
|
|
13476
|
+
}
|
|
13477
|
+
ownSpans() {
|
|
13478
|
+
if (this.shown === void 0 || this.shown.path !== this.litFor) return void 0;
|
|
13479
|
+
const spans = [];
|
|
13480
|
+
let at = 0;
|
|
13481
|
+
for (const entry of this.display) {
|
|
13482
|
+
const width = heldAt(entry, this.held).length;
|
|
13483
|
+
const here = isChrome(entry) ? NO_SPANS : this.litRow(entry);
|
|
13484
|
+
spans.push(...shifted(here, at, width));
|
|
13485
|
+
at += width + 1;
|
|
13486
|
+
}
|
|
13487
|
+
return spans;
|
|
13488
|
+
}
|
|
13353
13489
|
feed() {
|
|
13354
13490
|
const spans = noteSpans(this.display, this.held);
|
|
13355
13491
|
this.code.content = textAt(this.display, this.held);
|
|
13356
|
-
this.code.onHighlight = (highlights) =>
|
|
13492
|
+
this.code.onHighlight = (highlights) => {
|
|
13493
|
+
return [...(this.ownSpans() ?? highlights).filter((highlight) => !spans.some(([from, to]) => highlight[0] < to && highlight[1] > from)), ...spans];
|
|
13494
|
+
};
|
|
13357
13495
|
}
|
|
13358
13496
|
setWrap(on) {
|
|
13359
13497
|
if (on !== this.wrapped) {
|
|
@@ -13488,6 +13626,58 @@ var init_diffview = __esmMin((() => {
|
|
|
13488
13626
|
};
|
|
13489
13627
|
isChrome = (entry) => entry.comment || entry.gap || entry.prose;
|
|
13490
13628
|
heldAt = (entry, pan) => isChrome(entry) && pan > 0 ? `${" ".repeat(pan)}${entry.text}` : entry.text;
|
|
13629
|
+
NO_SPANS = [];
|
|
13630
|
+
lineStarts = (lines) => {
|
|
13631
|
+
const starts = [];
|
|
13632
|
+
let at = 0;
|
|
13633
|
+
for (const line of lines) {
|
|
13634
|
+
starts.push(at);
|
|
13635
|
+
at += line.length + 1;
|
|
13636
|
+
}
|
|
13637
|
+
return starts;
|
|
13638
|
+
};
|
|
13639
|
+
overLine = (start, starts) => {
|
|
13640
|
+
let low = 0;
|
|
13641
|
+
let high = starts.length - 1;
|
|
13642
|
+
while (low < high) {
|
|
13643
|
+
const mid = Math.ceil((low + high) / 2);
|
|
13644
|
+
if ((starts[mid] ?? 0) <= start) low = mid;
|
|
13645
|
+
else high = mid - 1;
|
|
13646
|
+
}
|
|
13647
|
+
return low;
|
|
13648
|
+
};
|
|
13649
|
+
shifted = (spans, at, width) => spans.filter(([from]) => from < width).map(([from, to, group]) => [
|
|
13650
|
+
at + from,
|
|
13651
|
+
at + Math.min(to, width),
|
|
13652
|
+
group
|
|
13653
|
+
]);
|
|
13654
|
+
acrossLines = (lines, starts, held, span) => {
|
|
13655
|
+
const [from, to, group] = span;
|
|
13656
|
+
let at = from;
|
|
13657
|
+
let line = overLine(at, starts);
|
|
13658
|
+
while (at < to && line < lines.length) {
|
|
13659
|
+
const start = starts[line] ?? 0;
|
|
13660
|
+
const width = lines[line]?.length ?? 0;
|
|
13661
|
+
const stop = Math.min(to, start + width);
|
|
13662
|
+
if (stop > at) held[line]?.push([
|
|
13663
|
+
at - start,
|
|
13664
|
+
stop - start,
|
|
13665
|
+
group
|
|
13666
|
+
]);
|
|
13667
|
+
at = start + width + 1;
|
|
13668
|
+
line += 1;
|
|
13669
|
+
}
|
|
13670
|
+
};
|
|
13671
|
+
spansByLine = (lines, found) => {
|
|
13672
|
+
const starts = lineStarts(lines);
|
|
13673
|
+
const held = lines.map(() => []);
|
|
13674
|
+
for (const [from, to, group] of found) acrossLines(lines, starts, held, [
|
|
13675
|
+
from,
|
|
13676
|
+
to,
|
|
13677
|
+
group
|
|
13678
|
+
]);
|
|
13679
|
+
return held;
|
|
13680
|
+
};
|
|
13491
13681
|
textAt = (display, pan) => display.map((entry) => heldAt(entry, pan)).join("\n");
|
|
13492
13682
|
noteSpans = (display, pan) => {
|
|
13493
13683
|
const spans = [];
|
|
@@ -13610,7 +13800,7 @@ var init_diffview = __esmMin((() => {
|
|
|
13610
13800
|
}));
|
|
13611
13801
|
//#endregion
|
|
13612
13802
|
//#region src/tui/render.ts
|
|
13613
|
-
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, STICKY_MAX, pickPaint, SELECTION, CURSOR, ACCENT, GAP_PAINT, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, makePaletteParts, makePendingParts, makeChoices, 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;
|
|
13803
|
+
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, makePendingParts, makeChoices, 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;
|
|
13614
13804
|
var init_render = __esmMin((() => {
|
|
13615
13805
|
init_command();
|
|
13616
13806
|
init_patch();
|
|
@@ -13630,7 +13820,7 @@ var init_render = __esmMin((() => {
|
|
|
13630
13820
|
COMPOSE_ACTION_ROWS = 2;
|
|
13631
13821
|
COMPOSE_PAD = 5;
|
|
13632
13822
|
COMPOSE_MIN_TEXT = 8;
|
|
13633
|
-
reportActions = () => t`${fg(palette.accent)("esc")} ${fg(palette.muted)("cancel")} ${fg(palette.accent)("^s")} ${fg(palette.muted)("copy and save")}`;
|
|
13823
|
+
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")}`;
|
|
13634
13824
|
actionsText = () => t`${fg(palette.accent)("esc")} ${fg(palette.muted)("cancel")} ${fg(palette.accent)("^a")} ${fg(palette.muted)("add to review")} ${fg(palette.accent)("^s")} ${fg(palette.muted)("comment now")}`;
|
|
13635
13825
|
SNIPPET_LINES = 4;
|
|
13636
13826
|
PALETTE_KEY = 7;
|
|
@@ -13672,7 +13862,7 @@ var init_render = __esmMin((() => {
|
|
|
13672
13862
|
text: Math.max(COMPOSE_MIN_TEXT, box - COMPOSE_PAD)
|
|
13673
13863
|
};
|
|
13674
13864
|
};
|
|
13675
|
-
laidOut = (lines, room) => lines.flatMap((line) => {
|
|
13865
|
+
laidOut$1 = (lines, room) => lines.flatMap((line) => {
|
|
13676
13866
|
const parts = wrapped(line, room);
|
|
13677
13867
|
return parts.length === 0 ? [""] : parts;
|
|
13678
13868
|
});
|
|
@@ -14173,7 +14363,7 @@ var init_render = __esmMin((() => {
|
|
|
14173
14363
|
panelPair = (state, placed, room) => {
|
|
14174
14364
|
const { entry } = placed;
|
|
14175
14365
|
return [{
|
|
14176
|
-
text: `${`${panelMark(state, placed.at)}${entry.fresh ? marks().comment : " "} `}${panelWhere(entry, room - PANEL_LEAD)}`,
|
|
14366
|
+
text: `${`${panelMark(state, placed.at)}${entry.fresh || entry.unread > 0 ? marks().comment : " "} `}${panelWhere(entry, room - PANEL_LEAD)}`,
|
|
14177
14367
|
tone: palette.ink
|
|
14178
14368
|
}, {
|
|
14179
14369
|
text: ` ${clip(panelBody(entry), Math.max(4, room - PANEL_LEAD))}`,
|
|
@@ -14202,8 +14392,10 @@ var init_render = __esmMin((() => {
|
|
|
14202
14392
|
at
|
|
14203
14393
|
}));
|
|
14204
14394
|
const fresh = placed.filter((one) => one.entry.fresh).length;
|
|
14205
|
-
const
|
|
14206
|
-
|
|
14395
|
+
const unread = placed.filter((one) => one.entry.unread > 0).length;
|
|
14396
|
+
const said = fresh > 0 ? `${fresh} ${PULL_HINT}` : unread > 0 ? `${unread} unread` : "";
|
|
14397
|
+
const banner = said.length === 0 ? [] : [{
|
|
14398
|
+
text: clip(said, room),
|
|
14207
14399
|
tone: palette.attention
|
|
14208
14400
|
}];
|
|
14209
14401
|
const sections = PANEL_ORDER.flatMap((section) => panelSection(state, placed, section, room));
|
|
@@ -14263,8 +14455,8 @@ var init_render = __esmMin((() => {
|
|
|
14263
14455
|
renderer.root.flexDirection = "column";
|
|
14264
14456
|
renderer.root.paddingLeft = FRAME_PAD;
|
|
14265
14457
|
renderer.root.paddingRight = FRAME_PAD;
|
|
14266
|
-
renderer.root.paddingTop =
|
|
14267
|
-
renderer.root.paddingBottom =
|
|
14458
|
+
renderer.root.paddingTop = 0;
|
|
14459
|
+
renderer.root.paddingBottom = 0;
|
|
14268
14460
|
this.header = bar(renderer, "header", palette.ink);
|
|
14269
14461
|
this.footer = bar(renderer, "footer", palette.faint);
|
|
14270
14462
|
this.body = makeBody(renderer);
|
|
@@ -14338,7 +14530,12 @@ var init_render = __esmMin((() => {
|
|
|
14338
14530
|
return this.view.rowAt(Math.max(0, y - this.view.screenTop() + this.lastTop));
|
|
14339
14531
|
}
|
|
14340
14532
|
viewportRows() {
|
|
14341
|
-
|
|
14533
|
+
const edges = this.diffPane.border === true ? PANE_EDGES : 0;
|
|
14534
|
+
const pane = this.diffPane.height - edges - STICKY_MAX;
|
|
14535
|
+
return Math.max(1, pane > 0 ? pane : this.diffRows());
|
|
14536
|
+
}
|
|
14537
|
+
lit(path, side, lines, found) {
|
|
14538
|
+
this.view.lit(path, side, lines, found);
|
|
14342
14539
|
}
|
|
14343
14540
|
noteRoom() {
|
|
14344
14541
|
return this.view.room();
|
|
@@ -14494,10 +14691,10 @@ var init_render = __esmMin((() => {
|
|
|
14494
14691
|
const shown = shownOf(state);
|
|
14495
14692
|
if (shown === void 0) return;
|
|
14496
14693
|
const patch = shown.patch;
|
|
14497
|
-
this.paintSticky(state, state.top);
|
|
14498
14694
|
this.view.setWrap(state.wrap);
|
|
14499
14695
|
this.view.setPan(state.pan);
|
|
14500
14696
|
this.view.show(patch, notesFor(state, patch.path), gapRowSet(shown), proseFor(state, patch.path));
|
|
14697
|
+
this.paintSticky(state, state.top);
|
|
14501
14698
|
this.view.fit(this.diffRows());
|
|
14502
14699
|
const height = this.view.rows();
|
|
14503
14700
|
const top = this.view.scrollTo(state.top, state.cursor);
|
|
@@ -14700,14 +14897,14 @@ var init_render = __esmMin((() => {
|
|
|
14700
14897
|
this.compose.visible = state.screen === "compose" || state.screen === "report";
|
|
14701
14898
|
if (state.screen !== "report") return;
|
|
14702
14899
|
const room = composeRoom(this.renderer.width);
|
|
14703
|
-
const lines = laidOut([
|
|
14704
|
-
"What went wrong? Everything on screen is attached for you.",
|
|
14900
|
+
const lines = laidOut$1([
|
|
14901
|
+
state.reportFull ? "What went wrong? Everything on screen is attached for you." : "What went wrong? Only what you type is sent.",
|
|
14705
14902
|
"",
|
|
14706
14903
|
drafted(state)
|
|
14707
14904
|
], room.text);
|
|
14708
14905
|
this.composeTitle.content = "Report a bug";
|
|
14709
14906
|
this.composeBody.content = lines.join("\n");
|
|
14710
|
-
this.composeActions.content = reportActions();
|
|
14907
|
+
this.composeActions.content = reportActions(state.reportFull);
|
|
14711
14908
|
this.compose.height = lines.length + COMPOSE_ACTION_ROWS + COMPOSE_CHROME;
|
|
14712
14909
|
this.compose.width = room.box;
|
|
14713
14910
|
this.compose.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room.box) / 2));
|
|
@@ -14760,7 +14957,7 @@ var init_render = __esmMin((() => {
|
|
|
14760
14957
|
const more = selectedLineCount(state) - snippet.length;
|
|
14761
14958
|
const tail = more > 0 ? [` … ${more} more lines`] : [];
|
|
14762
14959
|
const quoted = [...snippet, ...tail].map((line) => clip(line, room.text));
|
|
14763
|
-
const written = laidOut(drafted(state).split("\n"), room.text);
|
|
14960
|
+
const written = laidOut$1(drafted(state).split("\n"), room.text);
|
|
14764
14961
|
const lines = [
|
|
14765
14962
|
...quoted,
|
|
14766
14963
|
"",
|
|
@@ -14779,7 +14976,7 @@ var init_render = __esmMin((() => {
|
|
|
14779
14976
|
}));
|
|
14780
14977
|
//#endregion
|
|
14781
14978
|
//#region src/tui/display.ts
|
|
14782
|
-
var Display, paintWith, listenWith, shapeOf, displayOn;
|
|
14979
|
+
var Display, paintWith, listenWith, lightWith, shapeOf, displayOn;
|
|
14783
14980
|
var init_display = __esmMin((() => {
|
|
14784
14981
|
init_dist();
|
|
14785
14982
|
init_render();
|
|
@@ -14790,12 +14987,19 @@ var init_display = __esmMin((() => {
|
|
|
14790
14987
|
listenWith = (screen) => fn("Tui.listen")(function* (mouse) {
|
|
14791
14988
|
yield* sync(() => screen.listen(mouse));
|
|
14792
14989
|
});
|
|
14990
|
+
lightWith = (screen, path, side, lines) => gen(function* () {
|
|
14991
|
+
const filetype = pathToFiletype(path) ?? "text";
|
|
14992
|
+
if (filetype === "text" || lines.length === 0) return;
|
|
14993
|
+
const found = (yield* promise(() => getTreeSitterClient().highlightOnce(lines.join("\n"), filetype))).highlights;
|
|
14994
|
+
if (found !== void 0) screen.lit(path, side, lines, found);
|
|
14995
|
+
});
|
|
14793
14996
|
shapeOf = (screen) => ({
|
|
14794
14997
|
paint: paintWith(screen),
|
|
14795
14998
|
rows: sync(() => screen.viewportRows()),
|
|
14796
14999
|
room: sync(() => screen.noteRoom()),
|
|
14797
15000
|
columns: sync(() => screen.columns()),
|
|
14798
|
-
listen: listenWith(screen)
|
|
15001
|
+
listen: listenWith(screen),
|
|
15002
|
+
light: (path, side, lines) => lightWith(screen, path, side, lines)
|
|
14799
15003
|
});
|
|
14800
15004
|
displayOn = (renderer, repo) => sync$1(Display)(() => shapeOf(new Screen(renderer, repo)));
|
|
14801
15005
|
}));
|
|
@@ -14874,7 +15078,7 @@ var init_upgrade = __esmMin((() => {
|
|
|
14874
15078
|
return due ? `adiff ${latest} is out · adiff upgrade` : "";
|
|
14875
15079
|
}).pipe(withSpan("Tui.upgradeHint"));
|
|
14876
15080
|
upgradeHint = worded.pipe(orElseSucceed(() => ""));
|
|
14877
|
-
})), PRINTABLE, KEY_HISTORY, copyToClipboard, asKey, openedPull, byWord, WORD_STEP, caretSideways, caretFor, LISTENS, listens, keyName, App, settledPath, openingOn, launch, told, untilDestroyed, runOn, runTui;
|
|
15081
|
+
})), PRINTABLE, KEY_HISTORY, TRAIL_HISTORY, momentOf, copyToClipboard, asKey, openedPull, byWord, WORD_STEP, caretSideways, caretFor, erasedBy, LISTENS, listens, laidOut, keyName, App, settledPath, openingOn, launch, told, untilDestroyed, runOn, runTui;
|
|
14878
15082
|
var init_app = __esmMin((() => {
|
|
14879
15083
|
init_dist();
|
|
14880
15084
|
init_report();
|
|
@@ -14893,6 +15097,12 @@ var init_app = __esmMin((() => {
|
|
|
14893
15097
|
init_upgrade();
|
|
14894
15098
|
PRINTABLE = /^[\S ]$/;
|
|
14895
15099
|
KEY_HISTORY = 40;
|
|
15100
|
+
TRAIL_HISTORY = 20;
|
|
15101
|
+
momentOf = (named, state) => {
|
|
15102
|
+
const file = selectedPatch(state)?.path ?? "none";
|
|
15103
|
+
const place = `${state.screen}/${state.focus}`;
|
|
15104
|
+
return `${named.padEnd(16)} ${place.padEnd(16)} row ${String(state.cursor + 1).padStart(5)} ${file}`;
|
|
15105
|
+
};
|
|
14896
15106
|
copyToClipboard = (text) => {
|
|
14897
15107
|
const encoded = Buffer.from(text, "utf8").toString("base64");
|
|
14898
15108
|
process.stdout.write(`\u001B]52;c;${encoded}\u0007`);
|
|
@@ -14931,11 +15141,17 @@ var init_app = __esmMin((() => {
|
|
|
14931
15141
|
if (key.name === "end") return caretHomed(state, "end");
|
|
14932
15142
|
return key.name === "delete" ? deleted(state) : void 0;
|
|
14933
15143
|
};
|
|
15144
|
+
erasedBy = (state, key) => {
|
|
15145
|
+
if (key.meta || key.ctrl) return lineBackspaced(state);
|
|
15146
|
+
return key.option ? wordBackspaced(state) : backspaced(state);
|
|
15147
|
+
};
|
|
14934
15148
|
LISTENS = /* @__PURE__ */ new Set(["keys", "palette"]);
|
|
14935
15149
|
listens = (screen) => LISTENS.has(screen);
|
|
15150
|
+
laidOut = (key) => key.baseCode === void 0 || key.name.length !== 1 ? key.name : String.fromCodePoint(key.baseCode);
|
|
14936
15151
|
keyName = (key) => {
|
|
14937
15152
|
if (key.shift && key.name === "tab") return "shift+tab";
|
|
14938
|
-
const
|
|
15153
|
+
const named = laidOut(key);
|
|
15154
|
+
const base = key.shift && named.length === 1 ? named.toUpperCase() : named;
|
|
14939
15155
|
return key.ctrl ? `ctrl+${base}` : base;
|
|
14940
15156
|
};
|
|
14941
15157
|
App = class {
|
|
@@ -14953,6 +15169,7 @@ var init_app = __esmMin((() => {
|
|
|
14953
15169
|
remembered = "";
|
|
14954
15170
|
wrapKept = false;
|
|
14955
15171
|
keys = [];
|
|
15172
|
+
trail = [];
|
|
14956
15173
|
fading;
|
|
14957
15174
|
wheel = 0;
|
|
14958
15175
|
sideways = 0;
|
|
@@ -15253,7 +15470,7 @@ var init_app = __esmMin((() => {
|
|
|
15253
15470
|
onText(key) {
|
|
15254
15471
|
if (!takesText(this.state.screen)) return;
|
|
15255
15472
|
if (key.name === "backspace") {
|
|
15256
|
-
this.commit(
|
|
15473
|
+
this.commit(erasedBy(this.state, key));
|
|
15257
15474
|
return;
|
|
15258
15475
|
}
|
|
15259
15476
|
if (key.name === "down") {
|
|
@@ -15380,17 +15597,29 @@ var init_app = __esmMin((() => {
|
|
|
15380
15597
|
return;
|
|
15381
15598
|
}
|
|
15382
15599
|
const at = this.state.patches.findIndex((patch) => patch.path === entry.comment.file);
|
|
15383
|
-
|
|
15384
|
-
if (patch === void 0) {
|
|
15600
|
+
if (this.state.patches[at] === void 0) {
|
|
15385
15601
|
this.commit(withNoticeHere(this.state, `${entry.comment.file} is not on this branch`));
|
|
15386
15602
|
return;
|
|
15387
15603
|
}
|
|
15388
|
-
const
|
|
15389
|
-
|
|
15390
|
-
|
|
15391
|
-
cursor: rowAtSourceLine(patch, entry.comment.end)
|
|
15604
|
+
const shown = selectedPatch({
|
|
15605
|
+
...this.measured(),
|
|
15606
|
+
patchIndex: at
|
|
15392
15607
|
});
|
|
15393
|
-
|
|
15608
|
+
if (shown !== void 0 && rowShowing(shown, entry.comment.end) === void 0) {
|
|
15609
|
+
this.commit(withNoticeHere(this.state, "that comment is outside this diff"));
|
|
15610
|
+
return;
|
|
15611
|
+
}
|
|
15612
|
+
this.commit(openedAt(this.measured(), at, entry.comment.end));
|
|
15613
|
+
yield* this.turnedTo();
|
|
15614
|
+
yield* this.readAnswers(entry.comment.id);
|
|
15615
|
+
});
|
|
15616
|
+
}
|
|
15617
|
+
readAnswers(id) {
|
|
15618
|
+
return gen({ self: this }, function* () {
|
|
15619
|
+
const branch = selectedBranch(this.state);
|
|
15620
|
+
if (id === void 0 || branch === void 0) return;
|
|
15621
|
+
yield* markRead(this.repo, branch.branch, id);
|
|
15622
|
+
this.commit(withSent(this.state, yield* this.loadSent(branch.branch)));
|
|
15394
15623
|
});
|
|
15395
15624
|
}
|
|
15396
15625
|
settleHere() {
|
|
@@ -15466,14 +15695,14 @@ var init_app = __esmMin((() => {
|
|
|
15466
15695
|
return gen({ self: this }, function* () {
|
|
15467
15696
|
const was = this.state.patchIndex;
|
|
15468
15697
|
this.commit(reduce(this.measured(), delta > 0 ? "comment.next" : "comment.prev"));
|
|
15469
|
-
if (this.state.patchIndex !== was) yield* this.
|
|
15698
|
+
if (this.state.patchIndex !== was) yield* this.turnedTo();
|
|
15470
15699
|
});
|
|
15471
15700
|
}
|
|
15472
15701
|
commitSynced(action) {
|
|
15473
15702
|
return gen({ self: this }, function* () {
|
|
15474
15703
|
const was = this.state.patchIndex;
|
|
15475
15704
|
this.commit(reduce(this.measured(), action));
|
|
15476
|
-
if (this.state.patchIndex !== was) yield* this.
|
|
15705
|
+
if (this.state.patchIndex !== was) yield* this.turnedTo();
|
|
15477
15706
|
});
|
|
15478
15707
|
}
|
|
15479
15708
|
moveFile(delta) {
|
|
@@ -15585,13 +15814,24 @@ var init_app = __esmMin((() => {
|
|
|
15585
15814
|
}));
|
|
15586
15815
|
});
|
|
15587
15816
|
}
|
|
15817
|
+
turnedTo() {
|
|
15818
|
+
return gen({ self: this }, function* () {
|
|
15819
|
+
this.commit(withSource(this.state, []));
|
|
15820
|
+
yield* this.loadSource();
|
|
15821
|
+
});
|
|
15822
|
+
}
|
|
15588
15823
|
loadSource() {
|
|
15589
15824
|
return gen({ self: this }, function* () {
|
|
15590
15825
|
const branch = selectedBranch(this.state);
|
|
15591
15826
|
const patch = selectedPatch(this.state);
|
|
15592
15827
|
if (branch === void 0 || patch === void 0) return;
|
|
15593
|
-
const
|
|
15828
|
+
const asked = patch.path;
|
|
15829
|
+
const source = yield* fileSource(this.repo, branch.branch, asked);
|
|
15830
|
+
if (selectedPatch(this.state)?.path !== asked) return;
|
|
15594
15831
|
this.commit(withSource(this.state, source));
|
|
15832
|
+
yield* this.display.light(asked, "new", source);
|
|
15833
|
+
const before = yield* fileBefore(this.repo, branch.branch, asked);
|
|
15834
|
+
if (before.length > 0) yield* this.display.light(asked, "old", before);
|
|
15595
15835
|
});
|
|
15596
15836
|
}
|
|
15597
15837
|
expand(delta) {
|
|
@@ -15657,8 +15897,11 @@ var init_app = __esmMin((() => {
|
|
|
15657
15897
|
}
|
|
15658
15898
|
remember(action, key) {
|
|
15659
15899
|
if (takesText(this.state.screen) && action === void 0) return;
|
|
15660
|
-
|
|
15900
|
+
const named = action ?? keyName(key);
|
|
15901
|
+
this.keys.push(named);
|
|
15661
15902
|
if (this.keys.length > KEY_HISTORY) this.keys.shift();
|
|
15903
|
+
this.trail.push(momentOf(named, this.state));
|
|
15904
|
+
if (this.trail.length > TRAIL_HISTORY) this.trail.shift();
|
|
15662
15905
|
}
|
|
15663
15906
|
sendReport() {
|
|
15664
15907
|
return gen({ self: this }, function* () {
|
|
@@ -15669,6 +15912,7 @@ var init_app = __esmMin((() => {
|
|
|
15669
15912
|
const text = buildReport(this.state, {
|
|
15670
15913
|
repo: this.repo,
|
|
15671
15914
|
keys: this.keys,
|
|
15915
|
+
trail: this.trail,
|
|
15672
15916
|
failure: this.failure,
|
|
15673
15917
|
width: this.renderer.width,
|
|
15674
15918
|
height: this.renderer.height
|
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.59",
|
|
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": {
|