Skip to main content

Module content

Module content 

Source
Expand description

Per-document text content. Arc-shareable across multiple crate::Buffer views.

Content owns everything that belongs to the document itself:

  • The lines rope (text content).
  • The dirty_gen render-cache generation counter.
  • Manual folds (folds).

crate::Buffer is the per-window wrapper. It holds an Arc<RefCell<Content>> plus the per-window cursor. Two Buffer instances that share one Content see the same text and folds, but each moves its cursor independently.

§Concurrency

The application is single-threaded. RefCell is used instead of a Mutex — there is no runtime locking cost and the borrow checker enforces the aliasing rules at development time. Syntax workers and LSP handlers take snapshots (owned Vec<String> / String) rather than long-lived borrows, so they never hold a RefCell guard across an await point.

Structs§

Content
Per-document state shared across all crate::Buffer views of the same file. Wrap in Arc<RefCell<Content>> and pass to crate::Buffer::new_view to create an additional window onto the same content.