simvx.core.document

File-backed text documents with dirty tracking and a buffer registry.

Module Contents

Classes

Document

File-backed text document with dirty tracking.

BufferRegistry

Manages open documents with deduplication.

Data

log

API

simvx.core.document.log

‘getLogger(…)’

class simvx.core.document.Document(path: pathlib.Path | str | None = None, encoding: str = 'utf-8')

File-backed text document with dirty tracking.

Initialization

property content: str
property dirty: bool
property title: str
load() bool

Load content from file. Returns True on success.

save(path: pathlib.Path | str | None = None) bool

Save content to file. Returns True on success.

class simvx.core.document.BufferRegistry

Manages open documents with deduplication.

Initialization

open(path: pathlib.Path | str) simvx.core.document.Document

Open a file, deduplicating by resolved path.

create(content: str = '') simvx.core.document.Document

Create a new untitled buffer.

close(doc: simvx.core.document.Document) bool

Close a document. Returns False if dirty (caller should prompt).

property active: simvx.core.document.Document | None
property buffers: list[simvx.core.document.Document]
property has_dirty: bool