Skip to main content

find_editor_block

Function find_editor_block 

Source
pub(super) fn find_editor_block(
    mstore: &Store,
    tab_id: &str,
    connection: &str,
    caller: Option<&str>,
) -> Result<Option<EditorFound>, String>
Expand description

Find the Editor-view block in tab_id an agent’s open should reuse, on connection (its meta connection; absent and local are this computer), if any. Direct sibling of find_agent_block above, checking meta.view == "editor" instead of meta.agentId. An editor on another connection is never it: its reads and saves go there (remote terminals spec §6.3).

With several, editor_pick::choose decides, from the pane that asked (caller): one the tab shows (shown_block_ids) wins, then the nearest to the caller. When none is on screen, any Editor the tab holds does: a minimized pane, a background tab of a pane stack, or a pane behind a magnified one. The open then shows it (showBlockWithoutFocus, when the editor takes the file), instead of making a second Editor pane because the first was out of sight.