[84] Undo-Verlauf als Liste: Schritt-Beschriftungen im Kern, Sprung zu Schritt N, Panel "Verlauf"

This commit is contained in:
Claude committed 2026-10-29 19:09:16 +00:00
1 parent f61cd7c88d
commit b74140107f
19 files changed
+668 -24

No files matched your search

+24
View File
@@ -441,6 +441,30 @@ export class ProjectDocument {
return project;
}
/** Springt im Verlauf auf Undo-Tiefe `target` (mehrere Schritte, ein Kern-Aufruf); `null` = schon dort/ausserhalb. */
jumpTo(base: Project, target: number): Project | null {
if (base !== this.mirror || !this.handle) {
this.ensure(base);
return null;
}
const json = core().doc_history_jump(this.handle, target);
if (!json) return null;
const project = applyOps(base, JSON.parse(json) as CoreOp[], core().doc_last_hits(this.handle));
this.mirror = project;
return project;
}
/** Beschriftung (i18n-Schlüssel oder Text) für den nächsten neu angelegten Undo-Schritt; leer = keine. */
setHistoryLabel(label: string): void {
if (this.handle) core().doc_history_label(this.handle, label);
}
/** Beschriftungen der Verlaufsschritte: Undo (ältester zuerst) und Redo (nächster zuerst). */
historyLabels(): { undo: string[]; redo: string[] } {
const json = this.handle ? core().doc_history_labels(this.handle) : "";
return json ? (JSON.parse(json) as { undo: string[]; redo: string[] }) : { undo: [], redo: [] };
}
/** Verlaufsstand: Undo-/Redo-Tiefe und geschätzter Speicher (Bytes). */
historyState(): { undo: number; redo: number; bytes: number } {
const s = this.handle ? core().doc_history_state(this.handle) : new Float64Array(0);