pub struct Document {
pub buf: Buffer,
pub indent: Indent,
pub indent_override: IndentOverride,
pub detection: Option<Detection>,
pub source: DocumentSource,
/* private fields */
}Expand description
One document: the text buffer plus everything that used to live in parallel vectors keyed by buffer index (0014 wave 2). One struct, one arena — the alignment invariant is the type system now.
Fields§
§buf: Buffer§indent: IndentResolved at open/reload and after :tab-size/:indent-style
(0051 R08): manual override → confident detection → config.
indent_override: IndentOverrideExplicit :tab-size N / :indent-style … choices; they survive
reloads and config refreshes, and other buffers never touch them.
detection: Option<Detection>What the last detection pass concluded (None when indent_detect
is off) — :explain reports it with its confidence or reason.
source: DocumentSourceWhat backs this document (0021 §4): the surface payload lives in the source variant; readonly derives from it at construction.
Implementations§
Source§impl Document
impl Document
pub fn remote(buffer: Buffer, source: RemoteDocument) -> Self
pub fn directory(buffer: Buffer, source: RemoteDirectory) -> Self
pub fn remote_metadata(&self) -> Option<&RemoteDocument>
pub fn directory_metadata_ref(&self) -> Option<&RemoteDirectory>
Source§impl Document
impl Document
pub fn label(&self, cwd: &Path) -> String
pub fn new(buf: Buffer) -> Self
Sourcepub fn surface(buf: Buffer, surface: Surface, context: GitContext) -> Self
pub fn surface(buf: Buffer, surface: Surface, context: GitContext) -> Self
A git-memory surface: job-owned content, readonly derived from the source — not set by hand (0021 §4).
Sourcepub fn output(buf: Buffer) -> Self
pub fn output(buf: Buffer) -> Self
Named virtual content (:!cmd output, help, the undo browser):
readonly derived from the source. Temporary surfaces opened
through Editor::open_temporary_output also carry the return
point :q restores (0051 §7 R07).
Sourcepub fn container_file(
buf: Buffer,
container: ContainerId,
path: PathBuf,
) -> Self
pub fn container_file( buf: Buffer, container: ContainerId, path: PathBuf, ) -> Self
A file read from a container (0037 DC1a/b): readonly derived from the source; the path names container bytes, never a local file.
Sourcepub fn syntax_path(&self) -> Option<&Path>
pub fn syntax_path(&self) -> Option<&Path>
Syntax identity is data; parsers live on the display-analysis worker.
pub fn matches_target(&self, target: &FileTarget) -> bool
Sourcepub fn surface_payload(&self) -> Option<&Surface>
pub fn surface_payload(&self) -> Option<&Surface>
The surface payload, when this document is one.
Sourcepub fn surface_payload_mut(&mut self) -> Option<&mut Surface>
pub fn surface_payload_mut(&mut self) -> Option<&mut Surface>
Mutable surface payload, when this document is one.