Skip to main content

create_narrow_view

Function create_narrow_view 

Source
pub fn create_narrow_view(
    activator: &mut dyn ModeActivator,
    source_id: BufferId,
    source_handle: Arc<dyn Document>,
    start_line: u32,
    end_line: u32,
    label: &str,
    registry: CommandRegistryHandle,
    lang_registry: Option<Arc<LangRegistry>>,
) -> BufferId
Expand description

Allocate a one-excerpt multibuffer view over [start_line, end_line] (inclusive, 0-based) of source_id and activate NarrowMode on it. Returns the new view’s BufferId.

source_handle is the existing source buffer’s document handle (an Arc clone) — the narrow view shares it, so edits in the narrow view and the original pane stay live-synced (M.4). label is shown in the headerline ("[narrow] <label> L<start+1>–<end+1>"); pass the file name or a symbol name when known, else "".

Every entry surface (:narrow, Visual, the zn operator) funnels through here.