Phase 27: strengthen undo transactions and improve editor workflow

This commit is contained in:
Johannes Findeisen 2026-10-27 16:49:30 +01:00
commit c4daef7c42
21 changed files with 460 additions and 27 deletions

View file

@ -113,6 +113,14 @@ void xtc_history_destroy(xtc_history * h);
* @param p Project model; borrowed for this call.
* @return XTC_OK on success, or an error code describing the failure.
*/
/* Reserve fixed-capacity snapshot storage before a user command mutates a
* project or publishes a candidate. Idempotent; failure retains history/redo.
* The next record uses this storage without allocating. It remains reserved
* across rejected commands and is freed on record or history destruction.
* All calls are serialized on the control thread, never in the callback. */
xtc_result xtc_history_reserve(xtc_history *history);
/* Available adjacent steps; metadata-only, no cloning/allocation. */
xtc_result xtc_history_counts(const xtc_history *history, size_t *undo_count, size_t *redo_count);
xtc_result xtc_history_record(xtc_history * h, const xtc_project * p);
/**
* @brief Clones the adjacent undo or redo state without moving the history cursor.