> home > Custom Layer Boundary API

buffer_history_set_current_state_index

September 8th 2024
Modify the current state index and update the buffer contents to reflect the contents of the buffer as it was at that index.

Signature

C++
b32
buffer_history_set_current_state_index(Application_Links* app,
                                       Buffer_ID buffer_id,
                                       History_Record_Index index);

Parameters

app

the standard custom layer context pointer

buffer_id

the id of the buffer to modify

index

the new current state index value

Return

non-zero if the buffer exists, has history enabled, and contains a record at the given index, otherwise zero

Details

This call simultaneously changes the state index and modifies the buffer to reflect undoing the necessary records from the top of the stack, or redoing them if the state index is being moved forward.