Text_Buffer module

undo

procedureextensionexperimentalsince 0.31.0Source

Undoes the last step. Returns whether anything was undone and the offset where the cursor belongs.

Example↗
buffer: Text_Buffer;
defer free_buffer(*buffer);
set_text(*buffer, "hello");
erase(*buffer, 0, 5);
ok, cursor := undo(*buffer);
assert(ok && cursor == 5);
assert(buffer_to_string(*buffer, temp) == "hello");
undo :: (buffer: *Text_Buffer) -> (ok: bool, cursor: int)

Parameters

buffer: *Text_Buffer

Returns

ok: bool
cursor: int

See also