> home > Custom Layer Boundary API

buffer_history_get_current_state_index

September 8th 2024
Get the current state index of the history

Signature

C++
History_Record_Index
buffer_history_get_current_state_index(Application_Links* app,
                                       Buffer_ID buffer_id);

Parameters

app

the standard custom layer context pointer

buffer_id

the id of the buffer to query

Return

if the buffer exists and has history enabled, the current state index, otherwise zero

Details

The current state index indicates how far backward the user has undone. If the index is the most recent record, then nothing has been undone. This way undo-redo operations do not have to modify the history stack, and instead just move the current state index through the stack. Normal modifications to the buffer cause the history to discard everything after the current state index, before putting the new record on top of the stack.