Skip to main content

agent_doc_apply_patch_with_caret

Function agent_doc_apply_patch_with_caret 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn agent_doc_apply_patch_with_caret( doc: *const c_char, component_name: *const c_char, content: *const c_char, mode: *const c_char, caret_offset: i32, ) -> FfiPatchResult
Expand description

Apply a component patch with cursor-aware ordering for append mode.

When mode is "append" and caret_offset >= 0, the content is inserted at the line boundary before the caret position (if the caret is inside the component). This ensures agent responses appear above where the user is typing.

Pass caret_offset = -1 for normal behavior (identical to agent_doc_apply_patch).

ยงSafety

All pointers must be valid, non-null, NUL-terminated UTF-8.