pub struct Window {Show 142 fields
pub id: WindowId,
pub label: String,
pub root: PathBuf,
pub file_explorer: Option<FileTreeView>,
pub file_mod_times: HashMap<PathBuf, SystemTime>,
pub lsp: LspManager,
pub panel_ids: HashMap<String, BufferId>,
pub buffers: WindowBuffers,
pub buffer_metadata: HashMap<BufferId, BufferMetadata>,
pub event_logs: HashMap<BufferId, EventLog>,
pub status_message: Option<String>,
pub plugin_status_message: Option<String>,
pub prompt: Option<Prompt>,
pub bridge: AsyncBridge,
pub next_lsp_request_id: u64,
pub pending_completion_requests: HashSet<u64>,
pub completion_items: Option<Vec<CompletionItem>>,
pub scheduled_completion_trigger: Option<Instant>,
pub dabbrev_state: Option<DabbrevCycleState>,
pub pending_goto_definition_request: Option<u64>,
pub pending_references_request: Option<u64>,
pub pending_references_symbol: String,
pub pending_signature_help_request: Option<u64>,
pub pending_code_actions_requests: HashSet<u64>,
pub pending_code_actions_server_names: HashMap<u64, String>,
pub pending_code_actions: Option<Vec<(String, CodeActionOrCommand)>>,
pub folding_ranges_in_flight: HashMap<BufferId, (u64, u64)>,
pub folding_ranges_debounce: HashMap<BufferId, Instant>,
pub semantic_tokens_full_debounce: HashMap<BufferId, Instant>,
pub semantic_tokens_range_in_flight: HashMap<BufferId, (u64, usize, usize, u64)>,
pub semantic_tokens_range_last_request: HashMap<BufferId, (usize, usize, u64, Instant)>,
pub semantic_tokens_range_applied: HashMap<BufferId, (usize, usize, u64)>,
pub position_history: PositionHistory,
pub in_navigation: bool,
pub suppress_position_history_once: bool,
pub composite_buffers: HashMap<BufferId, CompositeBuffer>,
pub composite_view_states: HashMap<(LeafId, BufferId), CompositeViewState>,
pub grouped_subtrees: HashMap<LeafId, SplitNode>,
pub terminal_manager: TerminalManager,
pub terminal_buffers: HashMap<BufferId, TerminalId>,
pub terminal_backing_files: HashMap<TerminalId, PathBuf>,
pub terminal_log_files: HashMap<TerminalId, PathBuf>,
pub terminal_explicit_titles: HashSet<BufferId>,
pub plugin_state: HashMap<String, HashMap<String, Value>>,
pub authority_spec: SessionAuthoritySpec,
pub preview: Option<(LeafId, BufferId)>,
pub terminal_mode: bool,
pub terminal_mode_resume: HashSet<BufferId>,
pub terminal_link_hover: Option<TerminalLinkHover>,
pub seen_byte_ranges: HashMap<BufferId, HashSet<(usize, usize)>>,
pub previous_viewports: HashMap<LeafId, (usize, u16, u16)>,
pub same_buffer_scroll_sync: bool,
pub scroll_sync_manager: ScrollSyncManager,
pub file_explorer_visible: bool,
pub file_explorer_sync_in_progress: bool,
pub file_explorer_width: ExplorerWidth,
pub file_explorer_side: FileExplorerSide,
pub pending_file_explorer_show_hidden: Option<bool>,
pub pending_file_explorer_show_gitignored: Option<bool>,
pub file_explorer_decorations: HashMap<String, Vec<FileExplorerDecoration>>,
pub file_explorer_decoration_cache: FileExplorerDecorationCache,
pub file_explorer_slot_overrides: HashMap<String, Vec<FileExplorerSlotEntry>>,
pub file_explorer_slot_override_cache: FileExplorerSlotOverrideCache,
pub search_namespace: OverlayNamespace,
pub pending_search_range: Option<Range<usize>>,
pub live_grep_last_state: Option<LiveGrepLastState>,
pub overlay_preview_state: Option<OverlayPreviewState>,
pub auto_revert_enabled: bool,
pub file_rapid_change_counts: HashMap<PathBuf, (Instant, u32)>,
pub pending_async_prompt_callback: Option<JsCallbackId>,
pub pending_quit_unnamed_save: Vec<BufferId>,
pub search_case_sensitive: bool,
pub search_whole_word: bool,
pub search_use_regex: bool,
pub search_confirm_each: bool,
pub scheduled_diagnostic_pull: Option<(BufferId, Instant)>,
pub scheduled_inlay_hints_request: Option<(BufferId, Instant)>,
pub user_dismissed_lsp_languages: HashSet<String>,
pub editor_mode: Option<String>,
pub prompt_histories: HashMap<String, InputHistory>,
pub pending_close_buffer: Option<BufferId>,
pub completion_service: CompletionService,
pub lsp_diagnostic_namespace: OverlayNamespace,
pub diagnostic_result_ids: HashMap<String, String>,
pub lsp_server_statuses: HashMap<(String, String), LspServerStatus>,
pub lsp_menu_contributions: HashMap<(String, String), Vec<LspMenuItem>>,
pub stored_push_diagnostics: HashMap<String, HashMap<String, Vec<Diagnostic>>>,
pub stored_pull_diagnostics: HashMap<String, Vec<Diagnostic>>,
pub stored_diagnostics: Arc<HashMap<String, Vec<Diagnostic>>>,
pub stored_folding_ranges: Arc<HashMap<String, Vec<FoldingRange>>>,
pub dir_mod_times: HashMap<PathBuf, SystemTime>,
pub last_auto_revert_poll: Instant,
pub last_file_tree_poll: Instant,
pub git_index_resolved: bool,
pub pending_file_poll_rx: Option<Receiver<Vec<(PathBuf, Option<SystemTime>)>>>,
pub pending_dir_poll_rx: Option<Receiver<(Vec<(NodeId, PathBuf, Option<SystemTime>)>, Option<(PathBuf, SystemTime)>)>>,
pub ephemeral_terminals: HashSet<TerminalId>,
pub terminal_commands: HashMap<TerminalId, Vec<String>>,
pub terminal_resume_commands: HashMap<TerminalId, Vec<String>>,
pub plugin_dev_workspaces: HashMap<BufferId, PluginDevWorkspace>,
pub status_bar_values: HashMap<BufferId, HashMap<String, String>>,
pub key_context: KeyContext,
pub chord_state: Vec<(KeyCode, KeyModifiers)>,
pub previous_click_time: Option<Instant>,
pub previous_click_position: Option<(u16, u16)>,
pub click_count: u8,
pub mouse_enabled: bool,
pub mouse_cursor_position: Option<(u16, u16)>,
pub gpm_active: bool,
pub menu_bar_visible: bool,
pub menu_bar_auto_shown: bool,
pub tab_bar_visible: bool,
pub status_bar_visible: bool,
pub prompt_line_visible: bool,
pub last_auto_recovery_save: Instant,
pub last_persistent_auto_save: Instant,
pub warning_domains: WarningDomainRegistry,
pub tab_context_menu: Option<TabContextMenu>,
pub new_tab_menu: Option<NewTabMenu>,
pub file_explorer_context_menu: Option<FileExplorerContextMenu>,
pub theme_info_popup: Option<ThemeInfoPopup>,
pub event_debug: Option<EventDebug>,
pub file_open_state: Option<FileOpenState>,
pub file_browser_layout: Option<FileBrowserLayout>,
pub buffer_groups: HashMap<BufferGroupId, BufferGroup>,
pub buffer_to_group: HashMap<BufferId, BufferGroupId>,
pub next_buffer_group_id: usize,
pub pending_next_key_callbacks: VecDeque<JsCallbackId>,
pub key_capture_active: bool,
pub pending_key_capture_buffer: VecDeque<KeyEventPayload>,
pub active_custom_contexts: HashSet<String>,
pub keyboard_capture: bool,
pub review_hunks: Vec<ReviewHunk>,
pub pending_file_opens: Vec<PendingFileOpen>,
pub pending_hot_exit_recovery: bool,
pub wait_tracking: HashMap<BufferId, (u64, bool)>,
pub completed_waits: Vec<u64>,
pub search_overlay_top_byte: Option<usize>,
pub animations: AnimationRunner,
pub plugin_errors: Vec<String>,
pub file_explorer_clipboard: Option<FileExplorerClipboard>,
pub process_groups: ProcessGroups,
/* private fields */
}Fields§
§id: WindowIdStable identifier. The base window is always WindowId(1).
label: StringUser-visible label. Defaults to the basename of root (or
“main” when the root is the original process cwd). Not
required to be unique.
root: PathBufCanonical absolute path of the project root. Read-only after construction; closing a window and creating a new one is the way to “rename” the root.
file_explorer: Option<FileTreeView>File-explorer view (expansion, scroll, selection). None
means “never opened” — the caller rebuilds at root on first
toggle. Each window has its own view; switching windows shows
the new window’s tree (or none, if it hasn’t been opened yet).
file_mod_times: HashMap<PathBuf, SystemTime>Polling-based mtime cache for auto-revert. Auto-revert only fires for the active window’s files; inactive windows’ mtimes stay frozen at dive-out time and resync on dive-back — matching the user’s mental model that a dormant window “is paused”.
lsp: LspManagerLSP manager (running language servers, configs, per-language root URIs). Each window owns its own LSP set, rooted at its project root; inactive windows’ servers remain running in the background — that’s the warm-LSP property the design’s trade-off discussion calls out as a memory cost worth paying so dive-back is instant.
None means “this window has never spawned any LSP”; the
next LSP feature trigger will lazily create one.
This window’s language-server manager. Every window owns one,
built in Window::new rooted at the window’s project root —
there is no “window without a manager” state (that was the
“No LSP manager available” bug). Servers are still spawned
lazily on demand; an idle window’s manager holds only config.
panel_ids: HashMap<String, BufferId>Utility-dock panel-id → buffer-id occupancy. Each window gets its own dock — when one window has the search panel claimed and the user dives elsewhere, the new window starts with an empty dock and rebuilds on demand.
buffers: WindowBuffersBuffers attached to this window. Each window owns its
EditorStates outright; closing the window drops them.
Opening the same file in two windows produces two independent
buffers.
buffer_metadata: HashMap<BufferId, BufferMetadata>Per-buffer metadata (display name, file path / LSP URI,
virtual-buffer mode, read-only flag, LSP-opened set, preview
flag, etc.) for the buffers in Window.buffers. Lives next
to the buffer storage it describes; closing a window drops
every metadata entry along with the buffers themselves.
event_logs: HashMap<BufferId, EventLog>Per-buffer undo/redo event log. Lives next to buffers
because undo history is buffer-scoped — closing a window
drops the buffer and its log together.
status_message: Option<String>Status message (shown in this window’s status bar). Per-window because each window has its own context — a save in window A shouldn’t flash a status message into window B’s UI. Only the active window’s chrome renders, so background-window status messages are naturally invisible.
plugin_status_message: Option<String>Plugin-provided status message (displayed alongside the core status, also per-window).
prompt: Option<Prompt>Active prompt (minibuffer) for this window. Each window can have its own prompt mid-flight; switching windows preserves each window’s prompt state independently.
bridge: AsyncBridgePer-window async bridge — the (Sender, Receiver) pair the
LSP manager (and per-window terminal/file-explorer tasks
once they migrate) uses to deliver async responses back to
the main loop. Each window owns its own channel so cleanup
on closeWindow is automatic (the receiver drops, senders
error and stop). Editor-global async messages (plugin
runtime callbacks, file-open dialog) flow through
Editor.async_bridge instead.
next_lsp_request_id: u64Per-window LSP request-id allocator. Each window’s LspManager talks to its own server connections, and each connection only requires per-connection request-id uniqueness — no global namespace needed. Starts at 0 per window.
pending_completion_requests: HashSet<u64>Pending LSP completion request ids (multi-server).
completion_items: Option<Vec<CompletionItem>>Original LSP completion items (for type-to-filter).
scheduled_completion_trigger: Option<Instant>Scheduled completion-trigger time (debounced quick-suggestions).
dabbrev_state: Option<DabbrevCycleState>Dabbrev cycling state (Alt+/ session).
pending_goto_definition_request: Option<u64>Pending LSP go-to-definition request id.
pending_references_request: Option<u64>Pending LSP find-references request id and the symbol name.
pending_references_symbol: String§pending_signature_help_request: Option<u64>Pending LSP signature-help request id.
pending_code_actions_requests: HashSet<u64>Pending LSP code-actions request ids and per-request server-name attribution + the selected-from list.
pending_code_actions_server_names: HashMap<u64, String>§pending_code_actions: Option<Vec<(String, CodeActionOrCommand)>>§folding_ranges_in_flight: HashMap<BufferId, (u64, u64)>§folding_ranges_debounce: HashMap<BufferId, Instant>§semantic_tokens_full_debounce: HashMap<BufferId, Instant>§semantic_tokens_range_in_flight: HashMap<BufferId, (u64, usize, usize, u64)>§semantic_tokens_range_last_request: HashMap<BufferId, (usize, usize, u64, Instant)>§semantic_tokens_range_applied: HashMap<BufferId, (usize, usize, u64)>§position_history: PositionHistoryBack/forward navigation stack (cursor jumps, file switches) scoped to this window. Each window has its own history so switching windows doesn’t pollute the other window’s back-stack — diving back into a window resumes navigation where you left it.
true while a back/forward jump is in progress. Suppresses
track_cursor_movement from recording the jump itself as a
new entry. Per-window so windows don’t fight over the flag
during cross-window orchestration.
suppress_position_history_once: boolOne-shot suppression of position-history recording for the next buffer-switch (used by file-open paths that don’t want to leave a trail entry for the about-to-be-loaded file).
composite_buffers: HashMap<BufferId, CompositeBuffer>Composite buffers in this window (separate from regular buffers). These display multiple source buffers in a single tab — Live Grep results, References, Diagnostics list, etc. Owned per-window so the panel state follows the window that opened it.
composite_view_states: HashMap<(LeafId, BufferId), CompositeViewState>Per-split view state for composite buffers in this window. Keyed by (split_id, buffer_id) — each split that hosts a composite buffer gets its own scroll-row tracking.
grouped_subtrees: HashMap<LeafId, SplitNode>Grouped SplitNode subtrees for this window, keyed by their
LeafId (which is what TabTarget::Group(leaf_id)
references). Each entry is a SplitNode::Grouped node
holding the layout for one buffer group (Live Grep, References,
Diagnostics, etc.). These subtrees are NOT part of the main
split tree — they live here and are dispatched to at render
time when the current split’s active target is a Group.
Per-window because a buffer-group panel belongs to the window
that opened it.
terminal_manager: TerminalManagerTerminal subsystem (PTY processes + render-state grids) for
this window. Owned per-window so closing a window joins its
PTY threads — no orphan agents survive a closeWindow.
terminal_buffers: HashMap<BufferId, TerminalId>Maps a terminal-buffer id to its PTY id, scoped to this window.
terminal_backing_files: HashMap<TerminalId, PathBuf>Backing files for terminal buffers (the rendered visible-screen
- scrollback content the buffer actually displays).
terminal_log_files: HashMap<TerminalId, PathBuf>Raw log files for terminal buffers (the unfiltered byte stream from the PTY, used for replay / save-history).
terminal_explicit_titles: HashSet<BufferId>Terminal buffers whose tab title was set explicitly (plugin- or command-derived). These are excluded from foreground-process auto-naming so a program running inside doesn’t clobber the chosen title; an OSC title emitted by the program still takes precedence.
plugin_state: HashMap<String, HashMap<String, Value>>Plugin-managed per-window state. Outer key is plugin name,
inner is the plugin-defined key. Read via
editor.getWindowState(key) and written via
editor.setWindowState(key, value). Persisted to the
orchestrator’s global windows.json under the platform
data dir so it survives editor restarts.
Declarative spec for how to rebuild this session’s backend — the
persisted source of truth behind the live resources.authority. Set
when an authority is installed for the session (setAuthority →
Plugin, born-attached remote → RemoteAgent, new local → Local)
and round-tripped through the session’s workspace file so a restart /
relaunch can reconnect the backend rather than degrade it to local.
Local (the default) for an ordinary host-local session. A session
whose spec is remote but whose live authority is local is dormant
— disconnected, awaiting reconnect. See
docs/internal/PER_SESSION_BACKENDS_DESIGN.md.
preview: Option<(LeafId, BufferId)>Buffer currently opened in “preview” (ephemeral) mode, together
with the split (pane) it lives in. At most one preview exists
per window. Pre Step-0 this lived on Editor; moved here so
preview tracking follows the window’s other view-state.
Invariants:
- The
is_previewflag on the referenced buffer’s metadata is true iff this tuple isSomeand points at that buffer. - The preview is anchored to the split it was opened in.
- Cleared when the buffer is closed or promoted.
terminal_mode: boolWhether terminal mode is active in this window (input goes to the active terminal buffer). Per-window because each window has its own terminal set + active buffer.
terminal_mode_resume: HashSet<BufferId>Set of terminal buffer ids that should auto-resume terminal mode when switched back to. Per-window because terminal buffers are per-window (Step 0d).
terminal_link_hover: Option<TerminalLinkHover>Path-link currently highlighted under a Ctrl+hover over the live
terminal grid. Some means the renderer underlines the given grid row
columns to signal it’s clickable. Cleared when Ctrl is released or the
pointer leaves a resolvable path. See TerminalLinkHover.
seen_byte_ranges: HashMap<BufferId, HashSet<(usize, usize)>>Track which byte ranges have been seen per buffer (for the
lines_changed plugin-hook optimisation). Keyed by BufferId,
follows the buffers onto Window.
previous_viewports: HashMap<LeafId, (usize, u16, u16)>Previous viewport states for viewport_changed hook detection.
Stores (top_byte, width, height) from the end of the last
render frame. Keyed by LeafId, per-window because the splits
it tracks are per-window.
same_buffer_scroll_sync: boolWhether scroll syncing applies to splits showing the same buffer. Per-window UX toggle.
scroll_sync_manager: ScrollSyncManagerCross-split scroll-sync manager for side-by-side diff views. Per-window because the splits it pairs are per-window.
file_explorer_visible: boolWhether the file-explorer panel is visible in this window.
file_explorer_sync_in_progress: boolWhether a file-explorer rebuild is in flight (debounce flag).
file_explorer_width: ExplorerWidthWidth of the file-explorer panel.
file_explorer_side: FileExplorerSideSide (left/right) the file-explorer panel docks on.
Pending toggles for show-hidden/show-gitignored that apply on the next file-explorer rebuild.
pending_file_explorer_show_gitignored: Option<bool>§file_explorer_decorations: HashMap<String, Vec<FileExplorerDecoration>>Decorations supplied by plugins for the file explorer (badges, status icons, etc.) keyed by absolute path.
file_explorer_decoration_cache: FileExplorerDecorationCacheCompiled decoration lookup cache invalidated when
file_explorer_decorations changes.
file_explorer_slot_overrides: HashMap<String, Vec<FileExplorerSlotEntry>>Slot overrides supplied by plugins for the file explorer keyed by namespace. These are additive overrides: unspecified fields continue to fall back to compatibility providers.
file_explorer_slot_override_cache: FileExplorerSlotOverrideCacheCompiled slot-override lookup cache invalidated when
file_explorer_slot_overrides changes.
search_namespace: OverlayNamespaceOverlay namespace used for search-result highlights. Per-window because the overlays it scopes are per-buffer (per-window).
pending_search_range: Option<Range<usize>>Range that should be reused when the next search is confirmed (e.g. after the user picks a hit in the search overlay).
live_grep_last_state: Option<LiveGrepLastState>Last live-grep panel state (cached so re-opening the panel preserves the user’s query / scroll / selection).
overlay_preview_state: Option<OverlayPreviewState>Overlay-preview state used by the floating-prompt preview pane when it’s showing a buffer view.
auto_revert_enabled: boolWhether auto-revert (poll-based file-mtime watching) is enabled for buffers in this window.
file_rapid_change_counts: HashMap<PathBuf, (Instant, u32)>Tracks rapid file-change events for debouncing the auto-revert reload trigger.
pending_async_prompt_callback: Option<JsCallbackId>Pending plugin-issued prompt callback id (used by
editor.startPrompt to deliver the prompt result back).
pending_quit_unnamed_save: Vec<BufferId>Buffer ids the user picked “save before quit” for via the modified-buffers prompt; consumed in order on quit.
search_case_sensitive: boolPer-window search UX toggles. Each window has its own search session, so these flags follow the search state.
search_whole_word: bool§search_use_regex: bool§search_confirm_each: bool§scheduled_diagnostic_pull: Option<(BufferId, Instant)>Scheduled (debounced) per-buffer LSP feature requests for the active window’s LSP. Per-window because the LSP they target is per-window (Step 0k).
scheduled_inlay_hints_request: Option<(BufferId, Instant)>§user_dismissed_lsp_languages: HashSet<String>LSP languages the user dismissed the “do you want to enable LSP for this language?” popup for. Per-window because LSP is per-window — different windows can prompt independently.
editor_mode: Option<String>Active editor mode (e.g. “search”, “replace”, “macro-record”). Per-window because the modes drive UI affordances that belong to one window’s UX flow.
prompt_histories: HashMap<String, InputHistory>Per-window prompt histories (one ring per PromptType). Each
window has its own minibuffer, so each maintains its own
history.
pending_close_buffer: Option<BufferId>Buffer id pending close-confirmation prompt resolution. Per-window because the prompt that produced this is per-window.
completion_service: CompletionServicePluggable completion service that orchestrates this window’s completion providers (dabbrev, buffer words, LSP, plugin providers). Per-window because the providers it orchestrates (notably the LSP set) are per-window.
lsp_diagnostic_namespace: OverlayNamespaceOverlay namespace for LSP diagnostic overlays in this window (filter / bulk-remove key). The diagnostics it scopes are buffer overlays, and buffers are per-window, so the namespace follows.
diagnostic_result_ids: HashMap<String, String>Last result_id seen from the LSP server per URI for incremental
pull diagnostics. Per-window because each window has its own
LSP manager and therefore its own result-id stream.
lsp_server_statuses: HashMap<(String, String), LspServerStatus>Status of each (language, server_name) pair attached to this
window’s LspManager (running, errored, restarting, …).
Plugin-contributed menu items merged into the LSP-Servers popup
(the one opened by clicking the LSP indicator). Keyed by
(language, plugin_id) so each plugin owns its own slice and
can refresh it independently. The items render as an extra
section in build_and_show_lsp_status_popup between the
built-in actions and the trailing “View Log / Dismiss” rows.
Selecting one fires action_popup_result with popup_id = "lsp_status" and action_id = "{plugin_id}|{item_id}" so the
contributing plugin can react.
See #1941 follow-up “Option B”: instead of plugins pushing their own separate popup (which created the stacked-popup UX problem), they contribute items into the single LSP-Servers popup.
stored_push_diagnostics: HashMap<String, HashMap<String, Vec<Diagnostic>>>Push-model diagnostics keyed by URI, then by server name. Each
publishDiagnostics from a server replaces that server’s slice
for the URI; the merged view is materialised in
stored_diagnostics.
stored_pull_diagnostics: HashMap<String, Vec<Diagnostic>>Pull-model diagnostics (rust-analyzer-style native pull)
keyed by URI. Independent of stored_push_diagnostics; the
two are merged into stored_diagnostics for plugin / overlay
consumption.
stored_diagnostics: Arc<HashMap<String, Vec<Diagnostic>>>Merged view of push + pull diagnostics, exposed to plugins.
Arc wrapper so plugin snapshots can hold a refcount-bumped
reference; mutation goes through Arc::make_mut (CoW).
stored_folding_ranges: Arc<HashMap<String, Vec<FoldingRange>>>Per-URI folding ranges from textDocument/foldingRange. Same
Arc + CoW pattern as stored_diagnostics so plugin snapshots
don’t pin the underlying map across mutations.
dir_mod_times: HashMap<PathBuf, SystemTime>Per-directory mtime cache (paired with file_mod_times) for
detecting file-tree changes in this window. Per-window because
the file tree is per-window.
last_auto_revert_poll: InstantLast time auto-revert polled this window’s open buffers.
last_file_tree_poll: InstantLast time the file-tree change-detection poll fired for this window.
git_index_resolved: boolWhether this window has resolved and seeded the .git/index
path in dir_mod_times.
pending_file_poll_rx: Option<Receiver<Vec<(PathBuf, Option<SystemTime>)>>>Receiver for background file change poll results for this window.
Some while a metadata poll is in flight.
pending_dir_poll_rx: Option<Receiver<(Vec<(NodeId, PathBuf, Option<SystemTime>)>, Option<(PathBuf, SystemTime)>)>>Receiver for background directory change poll results for this window.
ephemeral_terminals: HashSet<TerminalId>Terminals in this window that should not persist to the workspace file. Plugin-created terminals default to ephemeral; user-opened terminals are absent and persist as before.
terminal_commands: HashMap<TerminalId, Vec<String>>Argv each terminal was spawned with, when it ran a command other than the plain shell (e.g. an Orchestrator agent). Captured at spawn and persisted into the workspace so a restored session re-runs the same command rather than coming back as a bare shell. Terminals spawned as a plain shell have no entry.
terminal_resume_commands: HashMap<TerminalId, Vec<String>>Argv to run on restore instead of re-running the launch command,
for terminals that carry an agent-resume spec (Orchestrator sets this
to e.g. claude --resume <id> / claude --continue). Persisted into
the workspace’s agent_resume; absent for plain terminals, which
just re-run their launch command.
plugin_dev_workspaces: HashMap<BufferId, PluginDevWorkspace>Plugin-development workspace per buffer (temp dir + LSP configuration for plugin buffers). Buffer-keyed and buffers are per-window, so the workspace map follows.
status_bar_values: HashMap<BufferId, HashMap<String, String>>Per-buffer plugin status-bar token values. Outer key: BufferId;
inner key: “plugin_name:token_name”; inner value: current text
to render. The registry of which tokens exist lives globally on
Editor.status_bar_token_registry; this map holds only the
values plugins have pushed for individual buffers.
key_context: KeyContextCurrently focused widget context (Normal / FileExplorer / Terminal / Prompt …). Per-window because each window has its own focus state — switching windows preserves each window’s focused widget.
chord_state: Vec<(KeyCode, KeyModifiers)>Pending chord sequence for multi-key bindings (e.g. C-x C-s). Each window tracks its own in-progress chord.
previous_click_time: Option<Instant>Multi-click detection state (per-window because clicks land inside a window).
previous_click_position: Option<(u16, u16)>§click_count: u8§mouse_enabled: boolWhether mouse capture is enabled in this window.
mouse_cursor_position: Option<(u16, u16)>GPM software-cursor position for this window (when GPM is active and we draw our own cursor).
gpm_active: boolPer-window chrome toggles. Each window can independently show or hide its menu bar / tab bar / status bar / prompt line.
tab_bar_visible: bool§status_bar_visible: bool§prompt_line_visible: bool§last_auto_recovery_save: InstantTiming state for auto-recovery saves and persistent auto-saves in this window.
last_persistent_auto_save: Instant§warning_domains: WarningDomainRegistryWarning domain registry for this window’s status indicator.
Tab context menu state (right-click on a tab in this window).
“+” new-tab popup menu state (left-click on the tab bar’s trailing
+ button). Offers “New Terminal” / “New File”.
File-explorer context menu state (right-click in the explorer).
theme_info_popup: Option<ThemeInfoPopup>Theme inspector popup (Ctrl+Right-Click) anchored in this window.
event_debug: Option<EventDebug>Event debug dialog state (when the event-debug modal is open in this window). The dialog records keystrokes for the window’s input pipeline so it’s logically per-window.
file_open_state: Option<FileOpenState>File-open dialog state (when PromptType::OpenFile is active in this window’s prompt).
file_browser_layout: Option<FileBrowserLayout>Cached layout for the file browser (mouse hit-testing).
buffer_groups: HashMap<BufferGroupId, BufferGroup>Buffer groups (multiple buffers shown as one tab) in this window.
buffer_to_group: HashMap<BufferId, BufferGroupId>Reverse index: buffer ID → group ID.
next_buffer_group_id: usizeNext buffer group id within this window.
pending_next_key_callbacks: VecDeque<JsCallbackId>Plugin keystroke-callback queue (in-flight getNextKey() callbacks).
key_capture_active: boolWhether a plugin currently has key-capture active in this window.
pending_key_capture_buffer: VecDeque<KeyEventPayload>Keys queued while key_capture_active was set but no callback
was pending — drained on the next AwaitNextKey.
active_custom_contexts: HashSet<String>Plugin-defined custom contexts active in this window (drives command palette visibility, e.g. “config-editor”).
keyboard_capture: boolWhether keyboard capture is active for the terminal in this window (terminal mode swallows non-toggle keys).
review_hunks: Vec<ReviewHunk>In-flight review session hunks for this window.
pending_file_opens: Vec<PendingFileOpen>Pending file-open queue (PendingFileOpen) for this window.
pending_hot_exit_recovery: boolWhether this window has a hot-exit recovery prompt pending.
wait_tracking: HashMap<BufferId, (u64, bool)>Plugin “wait until file opens” tracking (buffer_id → (wait_id, …)).
completed_waits: Vec<u64>Wait ids that have completed and need to be reported back to plugins.
search_overlay_top_byte: Option<usize>Anchor for the search-result overlay in this window.
animations: AnimationRunnerPer-window UI animation runner.
plugin_errors: Vec<String>Plugin error log (populated when plugin status messages match error patterns; tests assert against this).
file_explorer_clipboard: Option<FileExplorerClipboard>Cut/copy clipboard for file-explorer ops in this window. Each window has its own paste buffer; cross-window file ops would require a separately-shared clipboard.
process_groups: ProcessGroupsProcess-group tracking for everything this window owns
(today: pty children from terminal_manager.spawn).
Exposed through signal_all so window-level lifecycle
operations can terminate every spawned process in one
call regardless of how many terminals the window owns —
see process_group module docs for the authority-
pluggable Signaller design.
Implementations§
Source§impl Window
impl Window
Sourcepub fn handle_lsp_inlay_hints(
&mut self,
request_id: u64,
uri: String,
hints: Vec<InlayHint>,
)
pub fn handle_lsp_inlay_hints( &mut self, request_id: u64, uri: String, hints: Vec<InlayHint>, )
Handle LSP inlay hints response. Pure window-state mutation — pulls the in-flight request from the per-window pending map, version-checks against the current buffer state, and applies hints as virtual text.
Source§impl Window
impl Window
Sourcepub fn set_bookmark(&mut self, key: char)
pub fn set_bookmark(&mut self, key: char)
Set bookmark at the active buffer’s primary cursor position.
Sourcepub fn clear_bookmark(&mut self, key: char)
pub fn clear_bookmark(&mut self, key: char)
Clear a bookmark by key.
Sourcepub fn list_bookmarks(&mut self)
pub fn list_bookmarks(&mut self)
Show the list of bookmarks in the status bar. Bookmarks pointing at buffers that no longer exist render as “unknown”.
Source§impl Window
impl Window
Sourcepub fn grouped_split_ratio(&self, container: ContainerId) -> Option<f32>
pub fn grouped_split_ratio(&self, container: ContainerId) -> Option<f32>
Look up the ratio of a split container that lives inside one of the
stashed Grouped subtrees (i.e. not in the main split tree). Returns
None if no grouped subtree contains this container.
Sourcepub fn set_grouped_split_ratio(
&mut self,
container: ContainerId,
new_ratio: f32,
) -> bool
pub fn set_grouped_split_ratio( &mut self, container: ContainerId, new_ratio: f32, ) -> bool
Set the ratio of a split container that lives inside a stashed
Grouped subtree. Returns true if the container was found and
updated.
Sourcepub fn is_non_scrollable_buffer(&self, buffer_id: BufferId) -> bool
pub fn is_non_scrollable_buffer(&self, buffer_id: BufferId) -> bool
Whether the given buffer is marked non-scrollable. Buffer-group
panels can set scrollable: false (and Fixed panels default to
it) so the mouse wheel is a no-op and no scrollbar is drawn.
Source§impl Window
impl Window
Sourcepub fn is_composite_buffer(&self, buffer_id: BufferId) -> bool
pub fn is_composite_buffer(&self, buffer_id: BufferId) -> bool
Check if a buffer is a composite buffer
Sourcepub fn get_composite(&self, buffer_id: BufferId) -> Option<&CompositeBuffer>
pub fn get_composite(&self, buffer_id: BufferId) -> Option<&CompositeBuffer>
Get a composite buffer by ID
Sourcepub fn get_composite_mut(
&mut self,
buffer_id: BufferId,
) -> Option<&mut CompositeBuffer>
pub fn get_composite_mut( &mut self, buffer_id: BufferId, ) -> Option<&mut CompositeBuffer>
Get a mutable composite buffer by ID
Sourcepub fn active_composite_cursor_info(
&self,
) -> Option<(usize, usize, Vec<Option<usize>>)>
pub fn active_composite_cursor_info( &self, ) -> Option<(usize, usize, Vec<Option<usize>>)>
Cursor info for the active composite (diff-view) buffer.
Returns None when the active buffer is not a composite buffer.
Otherwise yields (focused_pane, pane_count, per_pane_source_line)
where each entry of per_pane_source_line is the 0-indexed source
line shown in that pane on the cursor’s aligned row (None where the
pane has no content on that row — e.g. the blank side of an insertion
or deletion). Plugins use this to map a side-by-side cursor back to a
concrete (file version, line) so they can open it on disk.
The cursor can rest on a hunk-header / spacer alignment row that has no
source content on any pane (e.g. at the very top of the diff, before
the first context line). From such a row “open the file” should still
target a real line, so the cursor row is first resolved to the nearest
row that carries content — scanning down (into the hunk the header
introduces) before up. Rows that already have content on at least one
pane are used as-is, preserving per-pane None for the blank side of
an add/delete.
Sourcepub fn set_composite_alignment(
&mut self,
buffer_id: BufferId,
alignment: LineAlignment,
)
pub fn set_composite_alignment( &mut self, buffer_id: BufferId, alignment: LineAlignment, )
Set the line alignment for a composite buffer
Sourcepub fn close_composite_buffer(&mut self, buffer_id: BufferId)
pub fn close_composite_buffer(&mut self, buffer_id: BufferId)
Close a composite buffer and clean up associated state
Sourcepub fn composite_focus_next(&mut self, split_id: LeafId, buffer_id: BufferId)
pub fn composite_focus_next(&mut self, split_id: LeafId, buffer_id: BufferId)
Switch focus to the next pane in a composite buffer
Sourcepub fn composite_focus_prev(&mut self, split_id: LeafId, buffer_id: BufferId)
pub fn composite_focus_prev(&mut self, split_id: LeafId, buffer_id: BufferId)
Switch focus to the previous pane in a composite buffer
Sourcepub fn composite_next_hunk(
&mut self,
split_id: LeafId,
buffer_id: BufferId,
) -> bool
pub fn composite_next_hunk( &mut self, split_id: LeafId, buffer_id: BufferId, ) -> bool
Navigate to the next hunk (composite-buffer diff view) on
split_id. Centers the new hunk header roughly a third of the
way down the viewport and syncs the editor cursor so the status
bar’s Ln/Col follows. Returns true iff a next hunk existed.
Sourcepub fn composite_prev_hunk(
&mut self,
split_id: LeafId,
buffer_id: BufferId,
) -> bool
pub fn composite_prev_hunk( &mut self, split_id: LeafId, buffer_id: BufferId, ) -> bool
Navigate to the previous hunk in a composite-buffer diff view.
See composite_next_hunk for behaviour.
Sourcepub fn composite_next_hunk_active(&mut self, buffer_id: BufferId) -> bool
pub fn composite_next_hunk_active(&mut self, buffer_id: BufferId) -> bool
Hunk navigation entry point that resolves split_id from this
window’s active split. Used by keybinding handlers that don’t
carry a split id.
Sourcepub fn composite_prev_hunk_active(&mut self, buffer_id: BufferId) -> bool
pub fn composite_prev_hunk_active(&mut self, buffer_id: BufferId) -> bool
composite_prev_hunk flavour for the active split.
Sourcepub fn composite_scroll(
&mut self,
split_id: LeafId,
buffer_id: BufferId,
delta: isize,
)
pub fn composite_scroll( &mut self, split_id: LeafId, buffer_id: BufferId, delta: isize, )
Scroll a composite-buffer view by delta rows, clamped to the
composite’s row count. No-op if the buffer or view state is
missing.
Sourcepub fn composite_scroll_to(
&mut self,
split_id: LeafId,
buffer_id: BufferId,
row: usize,
)
pub fn composite_scroll_to( &mut self, split_id: LeafId, buffer_id: BufferId, row: usize, )
Scroll a composite-buffer view to absolute row row, clamped.
Source§impl Window
impl Window
Sourcepub fn open_event_debug(&mut self)
pub fn open_event_debug(&mut self)
Open the event debug dialog in this window.
Sourcepub fn handle_event_debug_input(&mut self, event: &KeyEvent) -> InputResult
pub fn handle_event_debug_input(&mut self, event: &KeyEvent) -> InputResult
Handle input when the event debug dialog is active in this window.
Sourcepub fn is_event_debug_active(&self) -> bool
pub fn is_event_debug_active(&self) -> bool
Check if the event debug dialog is active in this window.
Source§impl Window
impl Window
Sourcepub fn focus_editor(&mut self)
pub fn focus_editor(&mut self)
Shift focus back to the editor pane (away from the file explorer) and post a per-window “Editor focused” status message.
Sourcepub fn file_explorer_search_clear(&mut self)
pub fn file_explorer_search_clear(&mut self)
Clear file-explorer state in priority order:
- If a pending cut sits in the clipboard, just cancel it (so a forgotten cut can’t silently move a file on the next paste).
- If the explorer has a multi-selection, clear it.
- If the explorer’s search input is active, clear the query.
- Otherwise, transfer focus back to the editor.
Sourcepub fn handle_set_file_explorer_decorations(
&mut self,
namespace: String,
decorations: Vec<FileExplorerDecoration>,
)
pub fn handle_set_file_explorer_decorations( &mut self, namespace: String, decorations: Vec<FileExplorerDecoration>, )
Install (or replace) a namespace of plugin-supplied file-explorer decorations for this window. Paths outside the window root are dropped silently. Triggers a rebuild of the per-path decoration cache the renderer reads.
Sourcepub fn handle_clear_file_explorer_decorations(&mut self, namespace: &str)
pub fn handle_clear_file_explorer_decorations(&mut self, namespace: &str)
Drop a namespace of plugin-supplied decorations and rebuild the per-path cache without it.
Sourcepub fn handle_set_file_explorer_slots(
&mut self,
namespace: String,
slots: Vec<FileExplorerSlotEntry>,
)
pub fn handle_set_file_explorer_slots( &mut self, namespace: String, slots: Vec<FileExplorerSlotEntry>, )
Install (or replace) a namespace of plugin-supplied file-explorer slot overrides for this window. Any omitted slot fields continue to fall back to the editor’s default compatibility providers.
Sourcepub fn handle_clear_file_explorer_slots(&mut self, namespace: &str)
pub fn handle_clear_file_explorer_slots(&mut self, namespace: &str)
Drop a namespace of plugin-supplied file-explorer slot overrides and rebuild the per-path cache without it.
Sourcepub fn rebuild_file_explorer_decoration_cache(&mut self)
pub fn rebuild_file_explorer_decoration_cache(&mut self)
Recompute the file_explorer_decoration_cache from the current
per-namespace decoration entries + the explorer’s symlink
mappings. Called after any decoration-mutating operation.
Sourcepub fn rebuild_file_explorer_slot_override_cache(&mut self)
pub fn rebuild_file_explorer_slot_override_cache(&mut self)
Recompute the file_explorer_slot_override_cache from the current
per-namespace slot overrides + the explorer’s symlink mappings.
Sourcepub fn file_explorer_clipboard(&self) -> Option<&FileExplorerClipboard>
pub fn file_explorer_clipboard(&self) -> Option<&FileExplorerClipboard>
Read-only access to this window’s file-explorer cut/copy clipboard.
Sourcepub fn file_explorer_copy(&mut self)
pub fn file_explorer_copy(&mut self)
Copy the file-explorer selection to this window’s clipboard.
Sourcepub fn file_explorer_cut(&mut self)
pub fn file_explorer_cut(&mut self)
Cut the file-explorer selection to this window’s clipboard.
Sourcepub fn sync_file_explorer_to_active_file(&mut self)
pub fn sync_file_explorer_to_active_file(&mut self)
Spawn an async expand-to-path of this window’s file-explorer tree, targeting the active buffer’s file. No-op when the explorer isn’t visible, a sync is already running, or the target path is outside the window’s root.
Source§impl Window
impl Window
Sourcepub fn open_file_no_focus(&mut self, path: &Path) -> Result<BufferId>
pub fn open_file_no_focus(&mut self, path: &Path) -> Result<BufferId>
Open a file without switching focus to it.
Window-scoped core of the open-file path: creates a new buffer
for the file (or returns the existing buffer id if already open)
without changing the active buffer. Rooted at this window’s own
root / resources so it can open files directly into a
non-active window (e.g. workspace restore) with no active-window
flip. If the file doesn’t exist, creates an unsaved buffer with
that filename.
Source§impl Window
impl Window
Sourcepub fn open_help_manual(&mut self)
pub fn open_help_manual(&mut self)
Open the built-in help manual in a read-only buffer.
If a help manual buffer already exists, switch to it instead of creating a new one.
Sourcepub fn open_keyboard_shortcuts(&mut self)
pub fn open_keyboard_shortcuts(&mut self)
Open the keyboard shortcuts viewer in a read-only buffer.
If a keyboard shortcuts buffer already exists, switch to it instead of creating a new one. The shortcuts are dynamically generated from the current keybindings configuration.
Source§impl Window
impl Window
Sourcepub fn apply_layout(&mut self, width: u16, height: u16, dock_cols: u16)
pub fn apply_layout(&mut self, width: u16, height: u16, dock_cols: u16)
Adopt the geometry handed down by Editor::relayout: cache the
screen dimensions and the editor-global dock width, reseed every
split viewport against the post-dock editor width, and resize the
visible terminal PTYs. Per-split viewport dimensions are refined
again at paint time by sync_viewport_to_content; terminals have
no such paint-time sync, which is why their PTY size must be pushed
here.
Source§impl Window
impl Window
Sourcepub fn toggle_fold_at_cursor(&mut self)
pub fn toggle_fold_at_cursor(&mut self)
Toggle folding at the current cursor position in the active buffer.
Sourcepub fn toggle_fold_at_line(&mut self, buffer_id: BufferId, line: usize)
pub fn toggle_fold_at_line(&mut self, buffer_id: BufferId, line: usize)
Toggle folding for the given line in the specified buffer.
Kept for callers that only have a line number (e.g. gutter clicks
that already resolved the line). Converts to a byte position and
delegates to Self::toggle_fold_at_byte.
Sourcepub fn toggle_fold_at_byte(&mut self, buffer_id: BufferId, byte_pos: usize)
pub fn toggle_fold_at_byte(&mut self, buffer_id: BufferId, byte_pos: usize)
Toggle folding at the given byte position in the specified buffer.
Source§impl Window
impl Window
Sourcepub fn jump_active_cursor_to(&mut self, position: usize, opts: JumpOptions)
pub fn jump_active_cursor_to(&mut self, position: usize, opts: JumpOptions)
Move the active cursor to position and guarantee that position is
rendered in the active viewport.
This is the canonical “jump the cursor somewhere” entry point. It
performs a direct cursor mutation (no MoveCursor event, no undo
entry, no cursor_moved plugin hook) and then funnels through
[Editor::ensure_active_cursor_visible_for_navigation] for the
visibility invariant.
Callers that need a MoveCursor event (undo + plugin hooks) should
build the event themselves and call
[Editor::ensure_active_cursor_visible_for_navigation] afterwards.
Guarantee the active cursor is visible in the active viewport.
Call this immediately after any cursor mutation that represents a programmatic jump (search match, goto-definition, jump-to-line, next-error, plugin scroll-to-position). It:
- Clears
skip_ensure_visibleso a stale prior scroll does not suppress this one. - Calls the lower-level
ensure_cursor_visible. - Verifies the cursor’s line is now within the viewport’s line
range. If it isn’t (the lower-level routine short-circuited, or
view_lines-aware logic disagreed with byte-line math), forces a hard recenter so the cursor lands roughly mid-viewport. - If the visible range moved at all and
recenter_on_scrollis set, recenters for context.
Step 3 is the safety net that makes “cursor moves but viewport stalls” (#1689) impossible to reproduce regardless of what the lower-level scroll machinery decides to do.
Source§impl Window
impl Window
Window-level navigation visibility primitive — see
[Editor::ensure_active_cursor_visible_for_navigation] for
the full contract. Operates on the active split of this
window and the supplied buffer (typically the
caller-resolved active_buffer()).
Source§impl Window
impl Window
Sourcepub fn ensure_active_tab_visible(
&mut self,
split_id: LeafId,
active_buffer: BufferId,
available_width: u16,
)
pub fn ensure_active_tab_visible( &mut self, split_id: LeafId, active_buffer: BufferId, available_width: u16, )
Ensure the active tab in a split is visible by adjusting its
scroll offset. Pure window-state mutation: split tree +
view_states + buffer_metadata + composite_buffers + grouped_subtrees
all live on Window.
Source§impl Window
impl Window
Sourcepub fn spawn_terminal_session(
&mut self,
cwd: Option<PathBuf>,
persistent: bool,
command_override: Option<Vec<String>>,
) -> Option<TerminalId>
pub fn spawn_terminal_session( &mut self, cwd: Option<PathBuf>, persistent: bool, command_override: Option<Vec<String>>, ) -> Option<TerminalId>
Spawn a new PTY-backed terminal session in this window and
record its log/backing files. Returns the terminal id on
success — does not create a buffer or attach to any
split. Callers are responsible for the rest of the wiring
(see create_terminal_buffer_attached /
create_terminal_buffer_detached).
cwd defaults to this window’s root when None. persistent
controls whether the backing files use stable names
(fresh-terminal-N.{log,txt}) so workspace restore can find
them, or per-spawn ephemeral suffixes
(fresh-terminal-eph-N-<ts>.{log,txt}); non-persistent
terminals are also added to ephemeral_terminals so the
workspace serialiser skips them.
On spawn failure the error is logged and a status message is
set on this window; the caller gets None back.
Sourcepub fn create_terminal_buffer_attached(
&mut self,
terminal_id: TerminalId,
split_id: LeafId,
) -> BufferId
pub fn create_terminal_buffer_attached( &mut self, terminal_id: TerminalId, split_id: LeafId, ) -> BufferId
Create a buffer for a terminal session in this window, attached
to the specified split. Mirrors the pre-migration body of
Editor::create_terminal_buffer_attached.
Sourcepub fn create_plugin_terminal(
&mut self,
cwd: Option<PathBuf>,
direction: Option<SplitDirection>,
ratio: Option<f32>,
focus: bool,
persistent: bool,
command: Option<Vec<String>>,
title: Option<String>,
) -> Result<(TerminalId, BufferId, Option<LeafId>), String>
pub fn create_plugin_terminal( &mut self, cwd: Option<PathBuf>, direction: Option<SplitDirection>, ratio: Option<f32>, focus: bool, persistent: bool, command: Option<Vec<String>>, title: Option<String>, ) -> Result<(TerminalId, BufferId, Option<LeafId>), String>
Plugin-facing terminal creation in this window. Handles all
the variants the JS editor.createTerminal API exposes:
direction = None: attach the terminal as a new tab in the window’s active split (or seed a fresh split layout rooted at the terminal if the window has never been activated and therefore has no layout yet).direction = Some(dir): create a new horizontal/vertical split off the active split and place the terminal there.ratiocontrols the split’s size (default 0.5).focuscontrols whether the new split becomes the window’s active split.
In all cases the leader pid is registered with the window’s
process_groups tracker so cross-window signal operations
(Stop / Archive / Delete) can reach the spawned process group.
Returns (terminal_id, buffer_id, created_split_id) on
success. created_split_id is Some when a split was created
(either explicitly via direction = Some or implicitly when
seeding a fresh layout in a never-activated window).
Sourcepub fn sync_terminal_titles(&mut self)
pub fn sync_terminal_titles(&mut self)
Refresh terminal buffers’ tab titles, tmux-style. Runs every frame,
but the expensive part — reading each terminal’s foreground process
group (tcgetpgrp + /proc) — is throttled to [FG_POLL_INTERVAL]
and cached; the cached name is re-applied to the tab on every frame
so the title is responsive to renders without re-running the syscall.
The tab label combines two sources (see [combine_terminal_title]):
- Foreground process name — the command currently in the
terminal’s foreground process group (e.g.
python3while a REPL runs,bashat the prompt). Mirrors tmux’s#{pane_current_command}; read on Linux,Noneelsewhere. - OSC title — what a program set via OSC 0/1/2 (e.g. a shell’s
user@host: ~/dirprompt title, or vim’sfile - VIM).
e.g. python3 — root@host: ~/proj. When only one is present that one
is used; when neither is, the default *Terminal N* stands.
Terminals with an explicit (plugin-/command-derived) title are left untouched — like a tmux manual rename, an intentional name opts out of auto-naming.
Both parts are sanitized (control characters stripped, length capped)
the same way as the host window title, and applied without the
name (k) disambiguation used for plugin titles.
Sourcepub fn open_terminal_in_window(&mut self) -> Option<(TerminalId, BufferId)>
pub fn open_terminal_in_window(&mut self) -> Option<(TerminalId, BufferId)>
Open a new terminal in this window: spawn the PTY, create
the buffer, attach to the active split, switch this window’s
active buffer to it, enable terminal mode, and resize the PTY
to match the split’s content area. Returns (terminal_id, buffer_id) on success.
Editor-wide effects (the buffer_activated plugin hook, the
status-bar exit-key message) are NOT fired here — that’s the
caller’s responsibility, gated on whether this window is the
editor-active one. See Editor::open_terminal for the
active-window wrapper that does both.
Sourcepub fn create_terminal_buffer_detached(
&mut self,
terminal_id: TerminalId,
) -> BufferId
pub fn create_terminal_buffer_detached( &mut self, terminal_id: TerminalId, ) -> BufferId
Create a buffer for a terminal session in this window without attaching to any split (used during session restore).
Sourcepub fn last_focused_terminal(&self) -> Option<TerminalId>
pub fn last_focused_terminal(&self) -> Option<TerminalId>
The terminal the user interacted with most recently: the latest
split in the focus LRU whose current buffer is a terminal. Falls
back to the newest open terminal when no split currently shows
one (e.g. the terminal sits in a background tab), and None
when the window has no terminals at all.
Source§impl Window
impl Window
Sourcepub fn get_active_terminal_state(&self) -> Option<MutexGuard<'_, TerminalState>>
pub fn get_active_terminal_state(&self) -> Option<MutexGuard<'_, TerminalState>>
Get the terminal state for the active buffer (if it’s a terminal buffer).
Sourcepub fn send_terminal_input(&mut self, data: &[u8])
pub fn send_terminal_input(&mut self, data: &[u8])
Send input bytes to this window’s active terminal (no-op if the active buffer is not a terminal).
Sourcepub fn send_terminal_key(&mut self, code: KeyCode, modifiers: KeyModifiers)
pub fn send_terminal_key(&mut self, code: KeyCode, modifiers: KeyModifiers)
Send a key event to this window’s active terminal. Picks “application cursor” vs “normal cursor” escape sequences based on the terminal’s current state.
Sourcepub fn send_terminal_mouse(
&mut self,
col: u16,
row: u16,
kind: TerminalMouseEventKind,
modifiers: KeyModifiers,
)
pub fn send_terminal_mouse( &mut self, col: u16, row: u16, kind: TerminalMouseEventKind, modifiers: KeyModifiers, )
Send a mouse event to this window’s active terminal.
Sourcepub fn is_terminal_in_alternate_screen(&self, buffer_id: BufferId) -> bool
pub fn is_terminal_in_alternate_screen(&self, buffer_id: BufferId) -> bool
Check if the given terminal buffer in this window is in alternate-screen mode (vim/less/htop etc.).
Sourcepub fn resize_terminal(&mut self, buffer_id: BufferId, cols: u16, rows: u16)
pub fn resize_terminal(&mut self, buffer_id: BufferId, cols: u16, rows: u16)
Resize a single terminal buffer’s PTY (only if buffer_id
belongs to this window’s terminal_buffers map).
Sourcepub fn resize_visible_terminals(&mut self)
pub fn resize_visible_terminals(&mut self)
Resize all this window’s visible terminal PTYs to match their
current split dimensions. Reads the window’s cached
terminal_width / terminal_height for the screen size.
Sourcepub fn sync_terminal_to_buffer(&mut self, buffer_id: BufferId)
pub fn sync_terminal_to_buffer(&mut self, buffer_id: BufferId)
Sync terminal content to the active terminal buffer’s text view for read-only viewing / selection.
Incremental streaming architecture:
- Scrollback has already been streamed to the backing file during PTY reads.
- We append the visible screen (~50 lines) to the backing file.
- Reload the buffer from the backing file (lazy load for large files).
Performance: O(screen_size) instead of O(total_history).
Sourcepub fn render_terminal_splits(
&self,
frame: &mut Frame<'_>,
split_areas: &[(LeafId, BufferId, Rect, Rect, usize, usize)],
cursor_visible_if_active: bool,
)
pub fn render_terminal_splits( &self, frame: &mut Frame<'_>, split_areas: &[(LeafId, BufferId, Rect, Rect, usize, usize)], cursor_visible_if_active: bool, )
Render terminal content for terminal buffers in this window’s
split areas. Overlays the live PTY grid (colors, attributes,
optional cursor) on top of the buffer’s regular text content
inside content_rect.
cursor_visible_if_active controls whether the cursor is
painted at all. The active-window render passes true so a
focused terminal in terminal_mode blinks normally; the
preview path passes false so the picker preview stays
read-only.
Window-local in every respect — reads terminal_buffers,
terminal_manager, terminal_mode, active_buffer(), and
resources.theme from self. The caller picks the window
(active vs previewed); this method never reaches back to an
Editor or to any other window.
Source§impl Window
impl Window
Sourcepub fn handle_toggle_page_view(&mut self)
pub fn handle_toggle_page_view(&mut self)
Toggle between Compose and Source view modes for the active split.
Source§impl Window
impl Window
Sourcepub fn create_virtual_buffer_detached(
&mut self,
name: String,
mode: String,
read_only: bool,
) -> BufferId
pub fn create_virtual_buffer_detached( &mut self, name: String, mode: String, read_only: bool, ) -> BufferId
Create a virtual buffer without attaching it to any split’s tab list.
Like Self::create_virtual_buffer but does not add the new
buffer to any split’s tab list. Use when the caller is going to
seed a freshly-created split (e.g. the Utility Dock leaf) with
the new buffer directly — without it, the buffer would briefly
appear as a phantom tab in the previously-active split, requiring
a separate cleanup pass to remove it.
Sourcepub fn create_virtual_buffer(
&mut self,
name: String,
mode: String,
read_only: bool,
) -> BufferId
pub fn create_virtual_buffer( &mut self, name: String, mode: String, read_only: bool, ) -> BufferId
Create a virtual buffer and add it to the active split’s tab bar.
Sourcepub fn set_virtual_buffer_content(
&mut self,
buffer_id: BufferId,
entries: Vec<TextPropertyEntry>,
) -> Result<(), String>
pub fn set_virtual_buffer_content( &mut self, buffer_id: BufferId, entries: Vec<TextPropertyEntry>, ) -> Result<(), String>
Replace a virtual buffer’s content + overlays + cursors clamp.
Pure window-state mutation: rewrites the buffer text, clears
and re-installs overlays for the new content, and clamps every
per-split cursor showing this buffer to a char boundary in
the new length. Returns Err when the buffer is missing.
Source§impl Window
impl Window
Sourcepub fn apply_folding_ranges_response(
&mut self,
buffer_id: BufferId,
lsp_ranges: Vec<FoldingRange>,
)
pub fn apply_folding_ranges_response( &mut self, buffer_id: BufferId, lsp_ranges: Vec<FoldingRange>, )
Apply LSP folding ranges to the named buffer’s folding_ranges
store. Pure window mutation — no editor-global state touched.
Used by the LSP folding-ranges response dispatcher after the
editor-global URI-keyed map has been updated.
Sourcepub fn alloc_lsp_request_id(&mut self) -> u64
pub fn alloc_lsp_request_id(&mut self) -> u64
Allocate a fresh per-window LSP request id and return it. The
counter is per-window because each window’s LspManager talks
to its own server connections — no global namespace needed.
Sourcepub fn has_pending_lsp_requests(&self) -> bool
pub fn has_pending_lsp_requests(&self) -> bool
True if this window has any in-flight LSP completion or goto-definition request whose response would still be relevant.
Sourcepub fn toggle_tab_bar(&mut self)
pub fn toggle_tab_bar(&mut self)
Toggle this window’s tab-bar visibility and post a status message.
Sourcepub fn toggle_status_bar(&mut self)
pub fn toggle_status_bar(&mut self)
Toggle this window’s status-bar visibility and post a status message.
Sourcepub fn toggle_prompt_line(&mut self)
pub fn toggle_prompt_line(&mut self)
Toggle this window’s prompt-line visibility and post a status message.
Sourcepub fn toggle_scroll_sync(&mut self)
pub fn toggle_scroll_sync(&mut self)
Toggle this window’s same-buffer scroll-sync flag and post a status message announcing the new state.
Sourcepub fn toggle_debug_highlights(&mut self)
pub fn toggle_debug_highlights(&mut self)
Toggle the active buffer’s debug_highlight_mode (shows byte
positions and highlight-span info on screen). No-op if there is
no active buffer.
Sourcepub fn is_editing_disabled(&self) -> bool
pub fn is_editing_disabled(&self) -> bool
True iff editing should be disabled for the active buffer (e.g. read-only virtual buffers like the help manual).
Sourcepub fn is_lsp_language_user_dismissed(&self, language: &str) -> bool
pub fn is_lsp_language_user_dismissed(&self, language: &str) -> bool
True iff language is currently user-dismissed in this window’s
LSP status pill.
Sourcepub fn dismiss_lsp_language(&mut self, language: &str)
pub fn dismiss_lsp_language(&mut self, language: &str)
Dismiss the LSP pill for language in this window until the user
re-enables it (or the editor restarts).
Sourcepub fn undismiss_lsp_language(&mut self, language: &str)
pub fn undismiss_lsp_language(&mut self, language: &str)
Undo a previous dismissal — the pill for language returns to its
normal style.
Sourcepub fn apply_event_to_buffer(
&mut self,
buffer_id: BufferId,
split_id: LeafId,
event: &Event,
)
pub fn apply_event_to_buffer( &mut self, buffer_id: BufferId, split_id: LeafId, event: &Event, )
Apply an event to a buffer + the cursors of a split inside this
window. Window-level method (not Editor-level) so the borrow
checker can split-borrow self.buffers and self.splits
cleanly without inline self.windows.get_mut(...) boilerplate
at the call site. No-op if the buffer or split is missing.
Sourcepub fn apply_event_to_keyed_buffer(
&mut self,
buffer_id: BufferId,
split_id: LeafId,
event: &Event,
)
pub fn apply_event_to_keyed_buffer( &mut self, buffer_id: BufferId, split_id: LeafId, event: &Event, )
Same as [apply_event_to_buffer] but operates on a buffer-group
panel’s keyed cursor (the keyed_states[buffer_id].cursors
inside the host split’s view state, not the host’s own cursors).
Used by event-apply paths that target a focused inner panel of
a Grouped split rather than the outer split’s leaf buffer.
Sourcepub fn ensure_cursor_visible_for_split(
&mut self,
buffer_id: BufferId,
split_id: LeafId,
)
pub fn ensure_cursor_visible_for_split( &mut self, buffer_id: BufferId, split_id: LeafId, )
Scroll the named split’s viewport so the buffer’s primary cursor
is visible. Calls into SplitViewState::ensure_cursor_visible
with the buffer’s text + marker list. No-op if buffer/split is
missing.
Sourcepub fn scroll_split_viewport_to(
&mut self,
buffer_id: BufferId,
split_id: LeafId,
target_line: usize,
lock_against_ensure_visible: bool,
)
pub fn scroll_split_viewport_to( &mut self, buffer_id: BufferId, split_id: LeafId, target_line: usize, lock_against_ensure_visible: bool, )
Scroll a split’s viewport to the given line, given a buffer to
resolve the line→byte offset. No-op if buffer/split is missing.
lock_against_ensure_visible: when true, sets the
skip-ensure-visible flag so the next render’s cursor-visibility
pass doesn’t undo this scroll. Plugin-driven jumps want true;
scroll-sync-from-active-to-other-splits wants false.
Sourcepub fn add_fold(
&mut self,
buffer_id: BufferId,
start: usize,
end: usize,
placeholder: Option<String>,
) -> bool
pub fn add_fold( &mut self, buffer_id: BufferId, start: usize, end: usize, placeholder: Option<String>, ) -> bool
Add a collapsed fold range on buffer_id’s marker list and on
every view state hosting the buffer. Returns true when the
buffer was found (so the caller knows to flag a render). No-op
when the buffer is missing.
Sourcepub fn clear_folds(&mut self, buffer_id: BufferId) -> bool
pub fn clear_folds(&mut self, buffer_id: BufferId) -> bool
Clear every fold range on buffer_id across the window’s view
states. Returns true when the buffer was found.
Sourcepub fn set_buffer_cursor_in_splits(
&mut self,
buffer_id: BufferId,
position: usize,
splits: &[LeafId],
)
pub fn set_buffer_cursor_in_splits( &mut self, buffer_id: BufferId, position: usize, splits: &[LeafId], )
Move every supplied split’s primary cursor to position in
buffer_id and re-anchor the viewport to keep it visible.
Caller is responsible for computing splits (typically by
walking the split tree plus any grouped subtrees on the
editor — those live outside the window). No-op for missing
buffer/splits.
Sourcepub fn set_split_scroll_to_byte(
&mut self,
buffer_id: BufferId,
leaf_id: LeafId,
top_byte: usize,
)
pub fn set_split_scroll_to_byte( &mut self, buffer_id: BufferId, leaf_id: LeafId, top_byte: usize, )
Scroll leaf_id’s viewport so the byte position top_byte is
the new top line, using buffer_id to resolve byte→line. Sets
skip_ensure_visible so the next render’s cursor-visibility
pass doesn’t undo the plugin-driven scroll. No-op for missing
buffer/split.
Sourcepub fn scroll_buffer_to_line_in_splits(
&mut self,
buffer_id: BufferId,
target_leaves: &[LeafId],
line: usize,
)
pub fn scroll_buffer_to_line_in_splits( &mut self, buffer_id: BufferId, target_leaves: &[LeafId], line: usize, )
Scroll every supplied split so line is roughly a third
from the top of the viewport, using buffer_id for line
resolution. Used for plugin-driven “scroll buffer to line”
where the caller has already collected target leaves
(including those from grouped subtrees).
Sourcepub fn restore_buffer_state_in_split(
&mut self,
buffer_id: BufferId,
split_id: LeafId,
file_state: &SerializedFileState,
)
pub fn restore_buffer_state_in_split( &mut self, buffer_id: BufferId, split_id: LeafId, file_state: &SerializedFileState, )
Apply a previously-saved cursor + scroll position to a
specific buffer’s keyed view state inside a specific split.
Restoration must NOT go through view_state.viewport /
view_state.cursors — those Deref to the split’s active
buffer’s view, which for open_file_no_focus is still the
previously-active buffer; writing through the Deref would
scroll the unrelated active buffer. After restoring the
fields, reconciles cursor visibility against viewport
(#1689 follow-up). No-op if buffer/split is missing.
Sourcepub fn enter_terminal_scrollback_view(
&mut self,
buffer_id: BufferId,
leaf_id: LeafId,
)
pub fn enter_terminal_scrollback_view( &mut self, buffer_id: BufferId, leaf_id: LeafId, )
Configure leaf_id’s viewport for a terminal-buffer
scrollback view: disable line wrap, clear any pending
skip-ensure-visible flag, then scroll so the buffer’s primary
cursor (positioned at end-of-buffer when entering scrollback)
is visible. No-op if the buffer or split is missing.
Sourcepub fn install_terminal_buffer_state(
&mut self,
buffer_id: BufferId,
new_state: EditorState,
)
pub fn install_terminal_buffer_state( &mut self, buffer_id: BufferId, new_state: EditorState, )
Install a freshly-loaded EditorState for a terminal buffer:
replace the slot’s state, push every per-split cursor showing
the buffer to end-of-buffer (scrollback start), clear the
modified flag (terminals are never user-modified), disable
editing (scrollback mode), and turn off line-number margins.
Used by workspace restore when re-loading the on-disk
rendering of a previously-running terminal.
Sourcepub fn scroll_split_by_lines(
&mut self,
buffer_id: BufferId,
leaf_id: LeafId,
delta: i32,
view_transform_tokens: Option<Vec<ViewTokenWire>>,
tab_size: usize,
)
pub fn scroll_split_by_lines( &mut self, buffer_id: BufferId, leaf_id: LeafId, delta: i32, view_transform_tokens: Option<Vec<ViewTokenWire>>, tab_size: usize, )
Scroll leaf_id’s viewport by delta lines (negative = up,
positive = down). Honours view_transform_tokens when present
(uses view-aware scrolling) and falls back to buffer-based
scroll_up / scroll_down. After scrolling, skips
ensure_visible and snaps the viewport top to a fold boundary
if the new top byte landed inside a collapsed fold.
tab_size is needed for view-line tokenization.
Sourcepub fn scroll_overlay_preview_by_lines(&mut self, delta: i32) -> bool
pub fn scroll_overlay_preview_by_lines(&mut self, delta: i32) -> bool
Scroll the Live Grep overlay’s preview pane by delta lines
(issue #2119). The preview lives in overlay_preview_state (not in
the split tree), so it needs its own scroll path rather than going
through scroll_split_by_lines. Returns true if a preview was present
and scrolled.
Sourcepub fn clear_lsp_overlays_for_buffer(
&mut self,
buffer_id: BufferId,
diagnostic_namespace: &OverlayNamespace,
)
pub fn clear_lsp_overlays_for_buffer( &mut self, buffer_id: BufferId, diagnostic_namespace: &OverlayNamespace, )
Clear LSP-related overlays (diagnostics, virtual texts,
folding ranges, and folds) for buffer_id, used when LSP is
being disabled for the buffer. Pure window-state mutation.
Sourcepub fn split_manager_mut(&mut self) -> Option<&mut SplitManager>
pub fn split_manager_mut(&mut self) -> Option<&mut SplitManager>
Mutable handle to this window’s split tree (or None when
the layout hasn’t been seeded yet). Useful at sites where
the caller already has a &mut Window from a direct
self.windows.get_mut(&id) and wants the split layout
without going back through Editor’s accessor.
Sourcepub fn split_view_states_mut(
&mut self,
) -> Option<&mut HashMap<LeafId, SplitViewState>>
pub fn split_view_states_mut( &mut self, ) -> Option<&mut HashMap<LeafId, SplitViewState>>
Mutable handle to this window’s per-leaf view state map.
Sourcepub fn splits_mut(
&mut self,
) -> Option<(&mut SplitManager, &mut HashMap<LeafId, SplitViewState>)>
pub fn splits_mut( &mut self, ) -> Option<(&mut SplitManager, &mut HashMap<LeafId, SplitViewState>)>
Both halves of the split layout at once. Returns None if
the layout hasn’t been seeded yet.
Sourcepub fn new(
id: WindowId,
label: impl Into<String>,
root: PathBuf,
authority: Authority,
resources: WindowResources,
) -> Self
pub fn new( id: WindowId, label: impl Into<String>, root: PathBuf, authority: Authority, resources: WindowResources, ) -> Self
Construct a window.
root is taken as-is (the caller is responsible for
canonicalisation). label defaults to the basename of
root when empty. resources is the editor-global service
bundle every window holds an Arc-cloned reference to — see
WindowResources for the rationale.
This window’s backend (local / devcontainer / remote) — owned by the window, never shared with another.
Sourcepub fn alloc_buffer_id(&self) -> BufferId
pub fn alloc_buffer_id(&self) -> BufferId
Allocate the next globally-unique BufferId.
Sourcepub fn set_status_message(&mut self, message: String)
pub fn set_status_message(&mut self, message: String)
Set this window’s status-bar message. Mirrors
Editor::set_status_message — moved here so handlers on
impl Window can post status without an Editor reference.
Clears any plugin-supplied status (matches Editor behaviour).
Sourcepub fn clear_status_message(&mut self)
pub fn clear_status_message(&mut self)
Clear this window’s status-bar message.
Sourcepub fn effective_active_pair(&self) -> (LeafId, BufferId)
pub fn effective_active_pair(&self) -> (LeafId, BufferId)
Resolve the effective (split, buffer) pair for the currently-
focused target inside this window. Returned invariant: the split
id is in splits.1 (view_states), its active_buffer equals
the returned buffer id, self.buffers contains the buffer id,
and the split’s keyed_states contains an entry for the buffer.
Falls back to the outer split when a buffer-group panel is
focused but any of those invariants doesn’t hold for the inner
leaf. Mirrors Editor::effective_active_pair.
Sourcepub fn active_buffer(&self) -> BufferId
pub fn active_buffer(&self) -> BufferId
The id of the buffer currently focused in this window.
Sourcepub fn effective_tabs_width(&self) -> u16
pub fn effective_tabs_width(&self) -> u16
Width available for tabs in this window. When the file explorer is visible the tabs row only spans the editor area; otherwise it spans the full terminal width.
Sourcepub fn effective_active_split(&self) -> LeafId
pub fn effective_active_split(&self) -> LeafId
The split id whose SplitViewState owns the currently-focused
cursors/viewport for this window.
Sourcepub fn active_state(&self) -> &EditorState
pub fn active_state(&self) -> &EditorState
Read-only handle to this window’s active buffer state. Panics
if the active buffer is missing — the invariants on
effective_active_pair guarantee it’s present.
Sourcepub fn active_state_mut(&mut self) -> &mut EditorState
pub fn active_state_mut(&mut self) -> &mut EditorState
Mutable handle to this window’s active buffer state.
Sourcepub fn buffer_state_mut(&mut self, id: BufferId) -> Option<&mut EditorState>
pub fn buffer_state_mut(&mut self, id: BufferId) -> Option<&mut EditorState>
Mutable handle to a specific buffer’s editor state, if it is loaded in this window.
Sourcepub fn buffer_state(&self, id: BufferId) -> Option<&EditorState>
pub fn buffer_state(&self, id: BufferId) -> Option<&EditorState>
Read-only handle to a specific buffer’s editor state, if it is loaded in this window.
Sourcepub fn active_cursors(&self) -> &Cursors
pub fn active_cursors(&self) -> &Cursors
Read-only cursor set for the active buffer in the active split. Group panels return their own cursors, not the outer split’s stale ones.
Sourcepub fn active_cursors_mut(&mut self) -> &mut Cursors
pub fn active_cursors_mut(&mut self) -> &mut Cursors
Mutable cursor set for the active buffer in the active split.
Sourcepub fn active_event_log(&self) -> &EventLog
pub fn active_event_log(&self) -> &EventLog
Read-only event log for the active buffer.
Sourcepub fn active_event_log_mut(&mut self) -> &mut EventLog
pub fn active_event_log_mut(&mut self) -> &mut EventLog
Mutable event log for the active buffer.
Sourcepub fn promote_buffer_from_preview(&mut self, buffer_id: BufferId)
pub fn promote_buffer_from_preview(&mut self, buffer_id: BufferId)
Promote a specific buffer from preview to permanent, if it was in preview mode. No-op if the buffer is not currently a preview.
Sourcepub fn promote_active_buffer_from_preview(&mut self)
pub fn promote_active_buffer_from_preview(&mut self)
Promote the active buffer from preview to permanent. Called on any buffer mutation so touching a preview buffer commits it.
Sourcepub fn promote_current_preview(&mut self)
pub fn promote_current_preview(&mut self)
Promote the current preview, regardless of which buffer it points at. Used before layout changes (split, close-split, move-tab) where the preview invariant (“anchored to a specific split”) would otherwise be broken by the operation itself.
Sourcepub fn promote_preview_if_not_in_split(&mut self, new_split: LeafId)
pub fn promote_preview_if_not_in_split(&mut self, new_split: LeafId)
Promote the current preview if it belongs to a split other
than new_split. Called from split-focus-change paths so
that moving focus away from the preview’s pane commits it.
Sourcepub fn is_buffer_preview(&self, buffer_id: BufferId) -> bool
pub fn is_buffer_preview(&self, buffer_id: BufferId) -> bool
Whether the given buffer is currently in preview (ephemeral)
mode. Primarily for tests; production code reads
self.preview or relies on the is_preview flag in the
buffer’s metadata.
Sourcepub fn current_preview(&self) -> Option<(LeafId, BufferId)>
pub fn current_preview(&self) -> Option<(LeafId, BufferId)>
The (split, buffer) tuple of the current preview tab, if any. Intended for tests that verify preview anchoring semantics.
Sourcepub fn is_terminal_buffer(&self, buffer_id: BufferId) -> bool
pub fn is_terminal_buffer(&self, buffer_id: BufferId) -> bool
Check if a buffer is a terminal buffer (in this window).
Sourcepub fn get_terminal_id(&self, buffer_id: BufferId) -> Option<TerminalId>
pub fn get_terminal_id(&self, buffer_id: BufferId) -> Option<TerminalId>
Get the terminal ID for a buffer (if it’s a terminal buffer in this window).
Sourcepub fn clear_search_overlays(&mut self)
pub fn clear_search_overlays(&mut self)
Clear the visual search overlays for the active buffer, preserving search state so F3/Shift+F3 still work.
Sourcepub fn clear_search_highlights(&mut self)
pub fn clear_search_highlights(&mut self)
Clear all search highlights from the active buffer and reset search state.
Sourcepub fn running_lsp_servers(&self) -> Vec<String>
pub fn running_lsp_servers(&self) -> Vec<String>
List the languages with currently-running LSP server handles in
this window. Wraps LspManager::running_servers.
Sourcepub fn pending_completion_requests_count(&self) -> usize
pub fn pending_completion_requests_count(&self) -> usize
Number of in-flight completion requests for this window.
Sourcepub fn completion_items_count(&self) -> usize
pub fn completion_items_count(&self) -> usize
Number of stored completion items currently visible in this window’s completion popup.
Sourcepub fn initialized_lsp_server_count(&self, language: &str) -> usize
pub fn initialized_lsp_server_count(&self, language: &str) -> usize
Number of initialized (handshake-complete) LSP servers for
language in this window.
Sourcepub fn shutdown_lsp_server(&mut self, language: &str) -> bool
pub fn shutdown_lsp_server(&mut self, language: &str) -> bool
Shutdown the LSP server for language in this window (marks it
disabled until manual restart). Returns true if a server was
shutdown, false if no server was running for that language.
Sourcepub fn enable_event_streaming<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
pub fn enable_event_streaming<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
Enable event-log streaming to path for every buffer’s event
log in this window.
Sourcepub fn log_keystroke(&mut self, key_code: &str, modifiers: &str)
pub fn log_keystroke(&mut self, key_code: &str, modifiers: &str)
Log a keystroke against the active buffer’s event log. No-op if the active buffer has no log entry.
Sourcepub fn has_active_lsp_progress(&self) -> bool
pub fn has_active_lsp_progress(&self) -> bool
Check if LSP has any active progress tasks (e.g., indexing) in this window.
Sourcepub fn get_lsp_progress(&self) -> Vec<(String, String, Option<String>)>
pub fn get_lsp_progress(&self) -> Vec<(String, String, Option<String>)>
Snapshot of the current LSP progress entries for this window:
(token, title, message) tuples.
Sourcepub fn is_lsp_server_ready(&self, language: &str) -> bool
pub fn is_lsp_server_ready(&self, language: &str) -> bool
Check if any LSP server for language is running in this
window. Includes servers registered under another language whose
scope accepts language (universal servers).
Sourcepub fn redirect_active_split_away_from_dock_if_needed(&mut self)
pub fn redirect_active_split_away_from_dock_if_needed(&mut self)
If the active leaf carries SplitRole::UtilityDock, move the
active leaf back to the user’s last regular editor leaf (or any
non-dock leaf as a fallback). Called from the file-open path so
that opening a file while a utility panel holds focus doesn’t
turn the dock into a tab strip for ordinary files.
Sourcepub fn restore_global_file_state(
&mut self,
buffer_id: BufferId,
path: &Path,
split_id: LeafId,
)
pub fn restore_global_file_state( &mut self, buffer_id: BufferId, path: &Path, split_id: LeafId, )
Restore per-file state (cursors, scroll, etc.) for a buffer in a
specific split, lazily loaded from disk via
PersistedFileWorkspace::load. No-op if there’s no saved state
for this path.
Sourcepub fn save_file_state_on_close(&self, buffer_id: BufferId)
pub fn save_file_state_on_close(&self, buffer_id: BufferId)
Save file state when a buffer is closed (for per-file session persistence). Walks this window’s splits to find one that has the buffer; no-op if no split contains it or the buffer isn’t a real on-disk file.
Sourcepub fn move_cursor_to_visible_area(
&mut self,
split_id: LeafId,
buffer_id: BufferId,
)
pub fn move_cursor_to_visible_area( &mut self, split_id: LeafId, buffer_id: BufferId, )
Move the cursor to a visible position within the current viewport. Called after scrollbar operations to ensure the cursor is in view.
Sourcepub fn calculate_max_scroll_position(
buffer: &mut Buffer,
viewport_height: usize,
) -> usize
pub fn calculate_max_scroll_position( buffer: &mut Buffer, viewport_height: usize, ) -> usize
Calculate the maximum allowed scroll position so the last line
is always at the bottom unless the buffer is smaller than the
viewport. Pure function on Buffer; lives on Window so the
scrollbar helpers (also on Window) can reach it.
Sourcepub fn split_at_position(
&self,
col: u16,
row: u16,
) -> Option<(LeafId, BufferId)>
pub fn split_at_position( &self, col: u16, row: u16, ) -> Option<(LeafId, BufferId)>
Find the split whose content or scrollbar area contains the
screen cell (col, row). Returns the split id and its buffer
id, or None when the position falls outside every split’s
content rect and outside every scrollbar gutter.
Sourcepub fn check_diagnostic_pull_timer(&mut self) -> bool
pub fn check_diagnostic_pull_timer(&mut self) -> bool
If a per-edit diagnostic-pull debounce has fired, send a fresh
textDocument/diagnostic request to the language server for the
scheduled buffer. Returns false because the new diagnostics arrive
asynchronously — the response handler will trigger any redraw.
Sourcepub fn open_local_file(&mut self, path: &Path) -> Result<BufferId>
pub fn open_local_file(&mut self, path: &Path) -> Result<BufferId>
Open a local file in this window (always uses local filesystem,
not remote). Used for opening files like the warning log when
the editor is connected to a remote server. Returns the buffer
id and switches the active buffer to it (via
Window::set_active_buffer, so no plugin hook fires — the
Editor caller is responsible for re-firing
buffer_activated if the hook is required).
Sourcepub fn mark_buffer_read_only(&mut self, buffer_id: BufferId, read_only: bool)
pub fn mark_buffer_read_only(&mut self, buffer_id: BufferId, read_only: bool)
Mark a buffer in this window as read-only (or writable), keeping
the per-buffer metadata read_only flag and the editor state’s
editing_disabled flag in sync.
Sourcepub fn clear_warnings(&mut self)
pub fn clear_warnings(&mut self)
Clear all warning indicators for this window (general + LSP) and post a “Warnings cleared” status message.
Sourcepub fn update_lsp_warning_domain(&mut self)
pub fn update_lsp_warning_domain(&mut self)
Recompute the LSP warning-domain level for this window from its
lsp_server_statuses map. Called whenever a server transitions
state.
Sourcepub fn check_semantic_highlight_timer(&self) -> bool
pub fn check_semantic_highlight_timer(&self) -> bool
Check if semantic highlight debounce timer has expired for any buffer in this window. Returns true if a redraw is needed because the debounce period has elapsed and semantic highlights need to be recomputed.
Sourcepub fn search_match_at_primary_cursor(&self) -> Option<Range<usize>>
pub fn search_match_at_primary_cursor(&self) -> Option<Range<usize>>
If an active search has placed the cursor inside a match, return that match’s byte range. Used by Ctrl-D (“Add cursor at next match”) so a substring search drives the selection — instead of expanding to the whole word — when the user presses Ctrl-D right after searching (issue #1697).
Sourcepub fn update_search_highlights(
&mut self,
query: &str,
search_fg: Color,
search_bg: Color,
)
pub fn update_search_highlights( &mut self, query: &str, search_fg: Color, search_bg: Color, )
Update search highlights in the visible viewport for the active
buffer. Caller passes theme colors as parameters because theme
is editor-global (not yet on Window.resources).
Sourcepub fn reevaluate_search_overlays_around(
&mut self,
edit_start: usize,
edit_new_len: usize,
search_fg: Color,
search_bg: Color,
)
pub fn reevaluate_search_overlays_around( &mut self, edit_start: usize, edit_new_len: usize, search_fg: Color, search_bg: Color, )
Re-evaluate committed search highlights around an edited region.
Search-match overlays are anchored by markers that merely track
byte positions through edits; they never re-check whether the text
they cover still matches the query. So editing inside a highlighted
match (or typing against its boundary, which can break a \b
whole-word rule) would leave a stale highlight on text that no
longer matches. This recomputes matches on just the line(s) touched
by the edit and swaps the search overlays in that span, so highlights
drop and appear exactly where the text starts/stops matching.
edit_start / edit_new_len are in post-edit byte coordinates (for
a deletion, edit_new_len is 0). Bounded to the affected lines to
keep it viewport-localized rather than a full-buffer rescan.
Sourcepub fn file_explorer_is_visible(&self) -> bool
pub fn file_explorer_is_visible(&self) -> bool
Whether this window’s file-explorer panel is visible.
Sourcepub fn file_explorer_extend_selection_up(&mut self)
pub fn file_explorer_extend_selection_up(&mut self)
Extend the file-explorer selection upward.
Sourcepub fn file_explorer_extend_selection_down(&mut self)
pub fn file_explorer_extend_selection_down(&mut self)
Extend the file-explorer selection downward.
Sourcepub fn file_explorer_toggle_select(&mut self)
pub fn file_explorer_toggle_select(&mut self)
Toggle the selection state of the focused file-explorer entry.
Sourcepub fn file_explorer_select_all(&mut self)
pub fn file_explorer_select_all(&mut self)
Select every visible entry in the file explorer.
Sourcepub fn file_explorer_search_push_char(&mut self, c: char)
pub fn file_explorer_search_push_char(&mut self, c: char)
Push a character onto the file-explorer search filter.
Sourcepub fn file_explorer_search_pop_char(&mut self)
pub fn file_explorer_search_pop_char(&mut self)
Pop the last character from the file-explorer search filter.
Sourcepub fn schedule_folding_ranges_refresh(&mut self, buffer_id: BufferId)
pub fn schedule_folding_ranges_refresh(&mut self, buffer_id: BufferId)
Schedule a folding-range refresh for a buffer (debounced). The debounce window timestamp is stored on the window’s per-buffer folding-ranges debounce map.
Sourcepub fn schedule_semantic_tokens_full_refresh(&mut self, buffer_id: BufferId)
pub fn schedule_semantic_tokens_full_refresh(&mut self, buffer_id: BufferId)
Schedule a full semantic-tokens refresh for a buffer (debounced).
No-op when enable_semantic_tokens_full is off in the active
config.
Sourcepub fn invalidate_layouts_for_buffer(&mut self, buffer_id: BufferId)
pub fn invalidate_layouts_for_buffer(&mut self, buffer_id: BufferId)
Invalidate cached layouts and view transforms for every split
that displays buffer_id. Pure window-state mutation: walks
the window’s split tree and view-state map.
Sourcepub fn adjust_other_split_cursors_for_event(&mut self, event: &Event)
pub fn adjust_other_split_cursors_for_event(&mut self, event: &Event)
Adjust cursors in other splits that share the same buffer after
an edit. The split that originated the event already had its
cursors moved by BufferState::apply; this method walks every
other split displaying the same buffer and shifts (or, for a
BulkEdit, resets) their cursors so they don’t dangle past
freshly-deleted text.
Sourcepub fn set_pane_buffer(&mut self, leaf: LeafId, buffer_id: BufferId)
pub fn set_pane_buffer(&mut self, leaf: LeafId, buffer_id: BufferId)
Atomically update both sides of the pane-buffer invariant for a
given leaf split: the split tree’s stored buffer AND the matching
SplitViewState.active_buffer / keyed_states map.
This is the one place that’s allowed to change “which buffer is
shown in pane leaf”. The two stores can never drift if every
caller goes through here (issue #1620).
If the leaf has no SplitViewState yet (e.g. mid-session-restore,
when the SVS is registered later), the tree is still updated and
the SVS sync is skipped — the caller is responsible for ensuring
the SVS exists by the time any input is routed.
Auto Trait Implementations§
impl !Freeze for Window
impl !RefUnwindSafe for Window
impl !Send for Window
impl !Sync for Window
impl !UnwindSafe for Window
impl Unpin for Window
impl UnsafeUnpin for Window
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more