Skip to main content

project_conversation

Function project_conversation 

Source
pub fn project_conversation(
    conv: &Conversation,
) -> (String, Vec<ConversationFold>)
Expand description

TCF: project the conversation to (transcript_text, fold_spans) in a single pass, so a fold’s line range can never drift from the rendered layout. The text half is what the drain diffs into the buffer; the span half is what the ToolCallFoldSource and ReasoningFoldSource read.

A tool call with captured input/output gains indented detail rows under its ▸ summary [status] head; the fold spans the head through the last detail row (head stays visible when closed, detail hides). Each multi-line reasoning block folds the same way. Detail-less tool calls and single-line reasoning yield no span — a 1-line fold is a z* no-op.

Fold line indices are 0-based on the split-on-\n grid and align with the buffer’s line numbers: the transcript occupies buffer lines 0..N and the prompt marker is appended after it, so it never shifts a transcript line.