Skip to main content

Module preview

Module preview 

Source
Expand description

Preview isolation (PI series).

In-pane picker preview renders buffer B as an isolated read-only projection in a pane — never mutating the committed buffer A, the global active-buffer hot state, or A’s resolved options / mode stack. See docs/dev/architecture/preview-isolation.md for the contract and docs/dev/operations/slice-plans/preview-isolation.md (PI series) for sequencing.

This module owns the two host-side pieces the design calls out:

  • PreviewOverride — the ephemeral per-pane sidecar value (Editor::preview_overrides, keyed by PaneId). It records the displayed buffer + the preview viewport (cursor / scroll) while a pane’s committed buffer_id stays put. Baked into the published pane-tree leaves at render-publish time (build_render_state) so the renderers show the displayed buffer while :ls / modeline / dispatch keep reading the committed one.
  • PreviewMode — the preview-mode minor (§10.2 resolution: option (a)) that owns ReadOnly = true and, by its presence on B’s own mode stack, the ephemeral “this buffer is being previewed” marker. It deliberately does not touch CursorLine, so a preview keeps the buffer’s cursorline (the target line stays highlighted — e.g. an LSP reference preview).

Structs§

PreviewMode
PI.2 (§10.2 option (a)): the preview-mode minor. Contributes ReadOnly = true to the buffer it is active on; its presence on a buffer’s mode stack is the ephemeral “previewing” marker (introspect via :describe-mode). Activated only on the previewed buffer B’s own stack (never A’s), so B’s resolved_options reflect read-only while the committed buffer is untouched.
PreviewOverride
PI.1: a pane’s ephemeral preview projection. Stored host-side in Editor::preview_overrides (keyed by PaneId) so the live Editor::pane_tree stays committed + geometry-only; the override is baked into the published pane-tree leaves each frame.