@cueloop/client 0.1.0-alpha.15 → 0.1.0-alpha.17
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/package.json +5 -5
- package/src/App.plan-review.test.tsx +1 -1
- package/src/App.readonly.test.tsx +3 -3
- package/src/App.rendering.test.tsx +16 -16
- package/src/App.test.tsx +1 -1
- package/src/App.tsx +193 -139
- package/src/App.walk.test.tsx +208 -0
- package/src/components/AnnotationCard.tsx +4 -4
- package/src/components/ComposeBar.tsx +2 -2
- package/src/components/ConfirmCard.stories.tsx +15 -0
- package/src/components/ConfirmCard.tsx +8 -1
- package/src/components/DiffSheet.tsx +8 -8
- package/src/components/PlanSheet.stories.tsx +3 -3
- package/src/components/PlanSheet.tsx +31 -31
- package/src/components/WalkWizard.stories.tsx +89 -0
- package/src/components/WalkWizard.tsx +146 -0
- package/src/components/__snapshots__/stories.test.tsx.snap +130 -0
- package/src/components/stories.test.tsx +1 -1
- package/src/components/story-fixtures.ts +1 -1
- package/src/components/story.ts +1 -1
- package/src/components/syntax-highlight.ts +1 -1
- package/src/components/theme-context.tsx +1 -1
- package/src/components/truncate-text.ts +6 -0
- package/src/config.test.ts +29 -29
- package/src/config.ts +13 -12
- package/src/editor.ts +1 -1
- package/src/herdr.ts +1 -1
- package/src/key-bindings.test.ts +18 -1
- package/src/key-bindings.ts +23 -2
- package/src/keymap.test.ts +138 -101
- package/src/keymap.ts +81 -56
- package/src/run.ts +3 -3
- package/src/serve.test.ts +6 -6
- package/src/serve.ts +7 -7
- package/src/session-controller.ts +140 -66
- package/src/theme.ts +20 -1
- package/src/view-diff.test.ts +8 -8
- package/src/view-diff.ts +22 -22
- package/src/{view.test.ts → view-plan.test.ts} +48 -48
- package/src/view-plan.ts +362 -0
- package/src/walk.test.ts +110 -0
- package/src/walk.ts +65 -0
- package/src/components/format.ts +0 -6
- package/src/view.ts +0 -341
package/src/walk.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Guided-walk projections: pure helpers over the diff row model - no
|
|
3
|
+
* IO, no React. The walk steps through the changed files in patch order;
|
|
4
|
+
* which files were seen lives on the session record (viewedPaths), which
|
|
5
|
+
* file is on screen is view state in the session controller.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { Annotation } from "@cueloop/schema";
|
|
9
|
+
import type { DiffRow } from "./view-diff";
|
|
10
|
+
|
|
11
|
+
/** One wizard step: a changed file with its stats and a short diff preview. */
|
|
12
|
+
export interface WalkFile {
|
|
13
|
+
path: string;
|
|
14
|
+
added: number;
|
|
15
|
+
removed: number;
|
|
16
|
+
/** The first changed lines, signed (+/-), for the card's diff preview. */
|
|
17
|
+
preview: { sign: "+" | "-"; text: string }[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Preview lines per card: enough to recognize the change, never a full diff. */
|
|
21
|
+
export const WALK_PREVIEW_ROWS = 5;
|
|
22
|
+
|
|
23
|
+
/** Collapse the diff rows into one walk step per changed file, in patch order. */
|
|
24
|
+
export function walkFiles(rows: DiffRow[]): WalkFile[] {
|
|
25
|
+
const files: WalkFile[] = [];
|
|
26
|
+
const byPath = new Map<string, WalkFile>();
|
|
27
|
+
for (const row of rows) {
|
|
28
|
+
let file = byPath.get(row.file);
|
|
29
|
+
if (!file) {
|
|
30
|
+
file = { path: row.file, added: 0, removed: 0, preview: [] };
|
|
31
|
+
byPath.set(row.file, file);
|
|
32
|
+
files.push(file);
|
|
33
|
+
}
|
|
34
|
+
if (row.kind !== "add" && row.kind !== "del") continue;
|
|
35
|
+
if (row.kind === "add") file.added += 1;
|
|
36
|
+
else file.removed += 1;
|
|
37
|
+
if (file.preview.length < WALK_PREVIEW_ROWS) {
|
|
38
|
+
file.preview.push({ sign: row.kind === "add" ? "+" : "-", text: row.text.replace(/\n$/, "") });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return files;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Where the walk resumes: the first file not yet marked viewed. All files
|
|
46
|
+
* viewed = the end card (index === files.length), so a finished walk reopens
|
|
47
|
+
* on its summary instead of restarting.
|
|
48
|
+
*/
|
|
49
|
+
export function firstUnviewedIndex(files: WalkFile[], viewedPaths: ReadonlySet<string>): number {
|
|
50
|
+
const index = files.findIndex((file) => !viewedPaths.has(file.path));
|
|
51
|
+
return index === -1 ? files.length : index;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Viewed count against the CURRENT file set - stale paths never inflate it. */
|
|
55
|
+
export function viewedCount(files: WalkFile[], viewedPaths: ReadonlySet<string>): number {
|
|
56
|
+
return files.filter((file) => viewedPaths.has(file.path)).length;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The agent's note for a file: an annotation with kind "note" whose anchor
|
|
61
|
+
* quote is the file path (the note contract in the shared review core).
|
|
62
|
+
*/
|
|
63
|
+
export function noteForFile(annotations: Annotation[], path: string): string | undefined {
|
|
64
|
+
return annotations.find((annotation) => annotation.kind === "note" && annotation.anchor.quote === path)?.body;
|
|
65
|
+
}
|
package/src/components/format.ts
DELETED
package/src/view.ts
DELETED
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The projection pipeline (#22): parse → display blocks (base vs working
|
|
3
|
-
* copy reconciled) → styled runs. Pure functions - the TUI renders the runs
|
|
4
|
-
* (the native text primitive wraps them), tests assert on them directly.
|
|
5
|
-
* One planning layer: rendering, navigation, and selection all derive from
|
|
6
|
-
* this module; the rendered/work offset mappings keep the native selection
|
|
7
|
-
* addressable over word-diffed blocks.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
lcsDiff,
|
|
12
|
-
parseBlocks,
|
|
13
|
-
resolveAnchor,
|
|
14
|
-
wordDiff,
|
|
15
|
-
type Annotation,
|
|
16
|
-
type Block,
|
|
17
|
-
} from "@cueloop/schema";
|
|
18
|
-
|
|
19
|
-
// ── display model ─────────────────────────────
|
|
20
|
-
|
|
21
|
-
export type DisplayType = "same" | "mod" | "del" | "add";
|
|
22
|
-
|
|
23
|
-
export interface DisplayBlock {
|
|
24
|
-
type: DisplayType;
|
|
25
|
-
kind: Block["kind"];
|
|
26
|
-
/** Block in the working copy (absent for del). */
|
|
27
|
-
work?: Block;
|
|
28
|
-
/** Block in the submitted revision (absent for add). */
|
|
29
|
-
base?: Block;
|
|
30
|
-
oliNum?: number;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function displayText(d: DisplayBlock): string {
|
|
34
|
-
return (d.work ?? d.base)!.text;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** Word-overlap similarity gate: an unrelated cut + insert must not merge. */
|
|
38
|
-
function similar(a: Block, b: Block): boolean {
|
|
39
|
-
if (a.kind !== b.kind) return false;
|
|
40
|
-
const words = (t: string) => new Set(t.toLowerCase().split(/\s+/).filter(Boolean));
|
|
41
|
-
const wa = words(a.text);
|
|
42
|
-
const wb = words(b.text);
|
|
43
|
-
let inter = 0;
|
|
44
|
-
for (const w of wa) if (wb.has(w)) inter++;
|
|
45
|
-
const union = wa.size + wb.size - inter;
|
|
46
|
-
return union === 0 ? true : inter / union >= 0.3;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/** Reconcile base blocks vs working blocks into the display list. */
|
|
50
|
-
export function buildDisplay(baseContent: string, workingContent?: string): DisplayBlock[] {
|
|
51
|
-
const baseBlocks = parseBlocks(baseContent);
|
|
52
|
-
if (workingContent === undefined) {
|
|
53
|
-
const out: DisplayBlock[] = baseBlocks.map((b) => ({ type: "same", kind: b.kind, work: b, base: b }));
|
|
54
|
-
numberOlis(out);
|
|
55
|
-
return out;
|
|
56
|
-
}
|
|
57
|
-
const workBlocks = parseBlocks(workingContent);
|
|
58
|
-
const sig = (b: Block) => b.kind + "\0" + b.text;
|
|
59
|
-
const ops = lcsDiff(baseBlocks, workBlocks, (x, y) => sig(x) === sig(y));
|
|
60
|
-
const out: DisplayBlock[] = [];
|
|
61
|
-
let k = 0;
|
|
62
|
-
while (k < ops.length) {
|
|
63
|
-
const op = ops[k]!;
|
|
64
|
-
if (op.t === "ctx") {
|
|
65
|
-
out.push({ type: "same", kind: op.b!.kind, work: op.b, base: op.a });
|
|
66
|
-
k++;
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
const dels: Block[] = [];
|
|
70
|
-
const adds: Block[] = [];
|
|
71
|
-
while (k < ops.length && ops[k]!.t !== "ctx") {
|
|
72
|
-
const o = ops[k]!;
|
|
73
|
-
if (o.t === "del") dels.push(o.a!);
|
|
74
|
-
else adds.push(o.b!);
|
|
75
|
-
k++;
|
|
76
|
-
}
|
|
77
|
-
let di = 0;
|
|
78
|
-
let ai = 0;
|
|
79
|
-
while (di < dels.length && ai < adds.length) {
|
|
80
|
-
if (similar(dels[di]!, adds[ai]!)) {
|
|
81
|
-
out.push({ type: "mod", kind: adds[ai]!.kind, base: dels[di]!, work: adds[ai]! });
|
|
82
|
-
di++;
|
|
83
|
-
ai++;
|
|
84
|
-
} else if (dels.length - di >= adds.length - ai) {
|
|
85
|
-
out.push({ type: "del", kind: dels[di]!.kind, base: dels[di]! });
|
|
86
|
-
di++;
|
|
87
|
-
} else {
|
|
88
|
-
out.push({ type: "add", kind: adds[ai]!.kind, work: adds[ai]! });
|
|
89
|
-
ai++;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
while (di < dels.length) out.push({ type: "del", kind: dels[di]!.kind, base: dels[di++]! });
|
|
93
|
-
while (ai < adds.length) out.push({ type: "add", kind: adds[ai]!.kind, work: adds[ai++]! });
|
|
94
|
-
}
|
|
95
|
-
numberOlis(out);
|
|
96
|
-
return out;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function numberOlis(disp: DisplayBlock[]): void {
|
|
100
|
-
let run = 0;
|
|
101
|
-
for (const d of disp) {
|
|
102
|
-
if (d.kind === "oli") d.oliNum = ++run;
|
|
103
|
-
else run = 0;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// ── marks (annotation highlights + keyboard span) ──
|
|
108
|
-
|
|
109
|
-
export type RunRole =
|
|
110
|
-
| "plain"
|
|
111
|
-
| "ins"
|
|
112
|
-
| "del"
|
|
113
|
-
| "mark-comment"
|
|
114
|
-
| "mark-suggestion"
|
|
115
|
-
| "kspan"
|
|
116
|
-
| "mark-focus";
|
|
117
|
-
|
|
118
|
-
export interface StyleRun {
|
|
119
|
-
text: string;
|
|
120
|
-
role: RunRole;
|
|
121
|
-
/** Offset of this run in the block's working text; null for del runs. */
|
|
122
|
-
start: number | null;
|
|
123
|
-
annotationId?: string;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export interface Mark {
|
|
127
|
-
start: number;
|
|
128
|
-
end: number;
|
|
129
|
-
role: RunRole;
|
|
130
|
-
annotationId?: string;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Resolve annotations against the working blocks and group marks per display
|
|
135
|
-
* index. Working blocks are the blocks of (workingCopy ?? artifact) - the
|
|
136
|
-
* same list buildDisplay derived work entries from.
|
|
137
|
-
*/
|
|
138
|
-
export function marksByDisplay(
|
|
139
|
-
annotations: Annotation[],
|
|
140
|
-
display: DisplayBlock[],
|
|
141
|
-
focusedId?: string,
|
|
142
|
-
): Map<number, Mark[]> {
|
|
143
|
-
// block list in "work space": display entries that carry a work block, in order
|
|
144
|
-
const workEntries = display
|
|
145
|
-
.map((d, dispIdx) => ({ d, dispIdx }))
|
|
146
|
-
.filter((e) => e.d.work !== undefined);
|
|
147
|
-
const workBlocks = workEntries.map((e) => e.d.work!);
|
|
148
|
-
const map = new Map<number, Mark[]>();
|
|
149
|
-
for (const a of annotations) {
|
|
150
|
-
const res = resolveAnchor(a.anchor, workBlocks);
|
|
151
|
-
if (!res) continue;
|
|
152
|
-
const entry = workEntries[res.blockIndex];
|
|
153
|
-
if (!entry) continue;
|
|
154
|
-
const marks = map.get(entry.dispIdx) ?? [];
|
|
155
|
-
marks.push({
|
|
156
|
-
start: res.start,
|
|
157
|
-
end: res.end,
|
|
158
|
-
role: a.id === focusedId ? "mark-focus" : a.kind === "suggestion" ? "mark-suggestion" : "mark-comment",
|
|
159
|
-
annotationId: a.id,
|
|
160
|
-
});
|
|
161
|
-
map.set(entry.dispIdx, marks);
|
|
162
|
-
}
|
|
163
|
-
return map;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/** Base runs for a display block: plain text, or word-diff for mod blocks. */
|
|
167
|
-
export function blockRuns(d: DisplayBlock, markup: boolean): StyleRun[] {
|
|
168
|
-
if (d.type === "mod" && markup) {
|
|
169
|
-
const ops = wordDiff(d.base!.text, d.work!.text);
|
|
170
|
-
const runs: StyleRun[] = [];
|
|
171
|
-
let off = 0;
|
|
172
|
-
for (const op of ops) {
|
|
173
|
-
if (op.t === "del") {
|
|
174
|
-
runs.push({ text: op.a!, role: "del", start: null });
|
|
175
|
-
} else {
|
|
176
|
-
runs.push({ text: op.b!, role: op.t === "add" ? "ins" : "plain", start: off });
|
|
177
|
-
off += op.b!.length;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return runs;
|
|
181
|
-
}
|
|
182
|
-
return [{ text: displayText(d), role: "plain", start: 0 }];
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/** Split runs at mark boundaries; marks only bind to runs with offsets. */
|
|
186
|
-
export function overlayMarks(runs: StyleRun[], marks: Mark[]): StyleRun[] {
|
|
187
|
-
if (!marks.length) return runs;
|
|
188
|
-
const out: StyleRun[] = [];
|
|
189
|
-
for (const run of runs) {
|
|
190
|
-
if (run.start === null) {
|
|
191
|
-
out.push(run);
|
|
192
|
-
continue;
|
|
193
|
-
}
|
|
194
|
-
const bounds = new Set<number>([0, run.text.length]);
|
|
195
|
-
for (const m of marks) {
|
|
196
|
-
const s = Math.max(0, m.start - run.start);
|
|
197
|
-
const e = Math.min(run.text.length, m.end - run.start);
|
|
198
|
-
if (s < e) {
|
|
199
|
-
bounds.add(s);
|
|
200
|
-
bounds.add(e);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
const runStart = run.start;
|
|
204
|
-
const pts = [...bounds].sort((a, b) => a - b);
|
|
205
|
-
for (let i = 0; i < pts.length - 1; i++) {
|
|
206
|
-
const s = pts[i]!;
|
|
207
|
-
const e = pts[i + 1]!;
|
|
208
|
-
if (s >= e) continue;
|
|
209
|
-
const abs = runStart + s;
|
|
210
|
-
const mark = marks.find((m) => m.start <= abs && runStart + e <= m.end);
|
|
211
|
-
out.push({
|
|
212
|
-
text: run.text.slice(s, e),
|
|
213
|
-
// a mark never overrides ins/del emphasis; it rides on plain text
|
|
214
|
-
role: mark && run.role === "plain" ? mark.role : run.role,
|
|
215
|
-
start: abs,
|
|
216
|
-
annotationId: mark?.annotationId ?? run.annotationId,
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
return out;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Rendered-text offset of a work-text offset within a block's runs. The
|
|
225
|
-
* rendered text is every run's text in order (inline del runs included);
|
|
226
|
-
* only positioned runs carry work offsets. Drives the renderer's native
|
|
227
|
-
* selection from keyboard span offsets - the quote-anchor path depends on
|
|
228
|
-
* this mapping staying exact.
|
|
229
|
-
*/
|
|
230
|
-
export function renderedOffsetFor(runs: StyleRun[], workOffset: number): number | null {
|
|
231
|
-
let rendered = 0;
|
|
232
|
-
for (const run of runs) {
|
|
233
|
-
if (run.start !== null && workOffset >= run.start && workOffset < run.start + run.text.length) {
|
|
234
|
-
return rendered + (workOffset - run.start);
|
|
235
|
-
}
|
|
236
|
-
rendered += run.text.length;
|
|
237
|
-
}
|
|
238
|
-
return null;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Work-text range covered by a rendered-text selection [start, end). Del runs
|
|
243
|
-
* and other unpositioned text inside the selection contribute nothing; the
|
|
244
|
-
* result is the tightest work range whose text the selection touched.
|
|
245
|
-
*/
|
|
246
|
-
export function workRangeForRendered(
|
|
247
|
-
runs: StyleRun[],
|
|
248
|
-
renderedStart: number,
|
|
249
|
-
renderedEnd: number,
|
|
250
|
-
): { start: number; end: number } | null {
|
|
251
|
-
let rendered = 0;
|
|
252
|
-
let range: { start: number; end: number } | null = null;
|
|
253
|
-
for (const run of runs) {
|
|
254
|
-
const runRenderedStart = rendered;
|
|
255
|
-
const runRenderedEnd = rendered + run.text.length;
|
|
256
|
-
rendered = runRenderedEnd;
|
|
257
|
-
if (run.start === null) continue;
|
|
258
|
-
const overlapStart = Math.max(renderedStart, runRenderedStart);
|
|
259
|
-
const overlapEnd = Math.min(renderedEnd, runRenderedEnd);
|
|
260
|
-
if (overlapEnd <= overlapStart) continue;
|
|
261
|
-
const workStart = run.start + (overlapStart - runRenderedStart);
|
|
262
|
-
const workEnd = run.start + (overlapEnd - runRenderedStart);
|
|
263
|
-
if (!range) range = { start: workStart, end: workEnd };
|
|
264
|
-
else {
|
|
265
|
-
range.start = Math.min(range.start, workStart);
|
|
266
|
-
range.end = Math.max(range.end, workEnd);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
return range;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/** Line delta between two revision contents, for the sheet-header summary. */
|
|
273
|
-
export function revisionDelta(previousContent: string, nextContent: string): { added: number; removed: number } {
|
|
274
|
-
const ops = lcsDiff(previousContent.split("\n"), nextContent.split("\n"), (a, b) => a === b);
|
|
275
|
-
let added = 0;
|
|
276
|
-
let removed = 0;
|
|
277
|
-
for (const op of ops) {
|
|
278
|
-
if (op.t === "add") added++;
|
|
279
|
-
else if (op.t === "del") removed++;
|
|
280
|
-
}
|
|
281
|
-
return { added, removed };
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
// ── keyboard span mode ────────────────────────
|
|
285
|
-
|
|
286
|
-
export interface SpanState {
|
|
287
|
-
dispIdx: number;
|
|
288
|
-
wordIdx: number;
|
|
289
|
-
wordEnd: number;
|
|
290
|
-
start: number;
|
|
291
|
-
end: number;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
export function wordRanges(text: string): [number, number][] {
|
|
295
|
-
const out: [number, number][] = [];
|
|
296
|
-
const re = /\S+/g;
|
|
297
|
-
let m: RegExpExecArray | null;
|
|
298
|
-
while ((m = re.exec(text))) out.push([m.index, m.index + m[0]!.length]);
|
|
299
|
-
return out;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
export function startSpan(dispIdx: number, text: string): SpanState | null {
|
|
303
|
-
const words = wordRanges(text);
|
|
304
|
-
if (!words.length) return null;
|
|
305
|
-
return { dispIdx, wordIdx: 0, wordEnd: 0, start: words[0]![0], end: words[0]![1] };
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
export function spanKey(span: SpanState, key: string, text: string): SpanState {
|
|
309
|
-
const words = wordRanges(text);
|
|
310
|
-
const s = { ...span };
|
|
311
|
-
const width = s.wordEnd - s.wordIdx;
|
|
312
|
-
if (key === "l") s.wordEnd = Math.min(words.length - 1, s.wordEnd + 1);
|
|
313
|
-
else if (key === "h") s.wordEnd = Math.max(s.wordIdx, s.wordEnd - 1);
|
|
314
|
-
else if (key === "w") {
|
|
315
|
-
const n = Math.min(words.length - 1 - width, s.wordIdx + 1);
|
|
316
|
-
s.wordIdx = n;
|
|
317
|
-
s.wordEnd = n + width;
|
|
318
|
-
} else if (key === "b") {
|
|
319
|
-
const n = Math.max(0, s.wordIdx - 1);
|
|
320
|
-
s.wordIdx = n;
|
|
321
|
-
s.wordEnd = n + width;
|
|
322
|
-
} else if (key === "$") s.wordEnd = words.length - 1;
|
|
323
|
-
else if (key === "0") {
|
|
324
|
-
s.wordEnd = width;
|
|
325
|
-
s.wordIdx = 0;
|
|
326
|
-
} else return span;
|
|
327
|
-
s.start = words[s.wordIdx]![0];
|
|
328
|
-
s.end = words[s.wordEnd]![1];
|
|
329
|
-
return s;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
// ── working-copy block operations ─────────────
|
|
333
|
-
|
|
334
|
-
/** The next work block after a display index (a del block re-enters before it). */
|
|
335
|
-
export function nextWorkBlock(display: DisplayBlock[], dispIdx: number): Block | undefined {
|
|
336
|
-
for (let i = dispIdx + 1; i < display.length; i++) {
|
|
337
|
-
const w = display[i]!.work;
|
|
338
|
-
if (w) return w;
|
|
339
|
-
}
|
|
340
|
-
return undefined;
|
|
341
|
-
}
|