alloc_buffer_markers_on_buffer
September 8th 2024
Allocate buffer markers inside a managed scope and attach them to a buffer
Signature
Managed_Object
alloc_buffer_markers_on_buffer(Application_Links* app,
Buffer_ID buffer_id,
i32 count,
Managed_Scope* optional_extra_scope);
Parameters
app
the standard custom layer context pointer
buffer_id
the buffer on which them markers will be attached
count
the number of markers to allocate
optional_extra_scope
either a null pointer, or a pointer to a managed scope
Return
on success, when the buffer exists, and the optional_extra_scope is valid, a new managed object id, otherwise zero
Details
By default, markers are allocated in the scope of the buffer they are attached to, this is how their lifetime is tied to the lifetime of the buffer. When an additional scope is supplied, it is combined with the buffer's scope via the same joining operation used in get_managed_scope_with_multiple_dependencies and the markers are allocated in that scope instead.
Markers are updated by edits to the buffer to which they are attached, so that they the same position in the buffer even as text is shifted around by edit operations. This can be used, for instance, to track the locations of compilation errors even as some compilation errors have already been fixed and shifted the position of later errors.
Related