Skip to main content

Editor

Struct Editor 

Source
pub struct Editor {
    pub remote_indicator_override: Option<RemoteIndicatorOverride>,
    /* private fields */
}
Expand description

The main editor struct - manages multiple buffers, clipboard, and rendering

Fields§

§remote_indicator_override: Option<RemoteIndicatorOverride>

Plugin-supplied override for the Remote Indicator. Takes precedence over the authority-derived state at render time. Cleared on editor restart (plugins must reassert the state after setAuthority). See PluginCommand::SetRemoteIndicatorState.

Implementations§

Source§

impl Editor

Source

pub fn process_async_messages(&mut self) -> bool

Process pending async messages from the async bridge

This should be called each frame in the main loop to handle:

  • LSP diagnostics
  • LSP initialization/errors
  • File system changes (future)
  • Git status updates
Source§

impl Editor

Source

pub fn close_buffer(&mut self, id: BufferId) -> Result<()>

Close the given buffer

Source

pub fn force_close_buffer(&mut self, id: BufferId) -> Result<()>

Force close the given buffer without checking for unsaved changes Use this when the user has already confirmed they want to discard changes

Source

pub fn switch_buffer(&mut self, id: BufferId)

Switch to the given buffer

Source

pub fn close_tab(&mut self)

Close the current tab in the current split view. If the tab is the last viewport of the underlying buffer, do the same as close_buffer (including triggering the save/discard prompt for modified buffers).

When the active tab is a buffer group (its active_group_tab is set), this closes the entire group rather than the currently-focused inner panel buffer. Individual panels are internal details of the group — the user closes them all together by closing the group tab.

Source

pub fn close_tab_in_split( &mut self, buffer_id: BufferId, split_id: LeafId, ) -> bool

Close a specific tab (buffer) in a specific split.

This is the single shared implementation used by:

  • the mouse × button on a tab,
  • the Close Buffer command (via close_tab),
  • the Close Tab command and the Alt+W keybinding (via close_tab).

All three paths should behave identically; keep new logic here. Returns true if the tab was closed without needing a prompt.

Source

pub fn close_other_tabs_in_split( &mut self, keep_buffer_id: BufferId, split_id: LeafId, )

Close all other tabs in a split, keeping only the specified buffer

Source

pub fn close_tabs_to_right_in_split( &mut self, buffer_id: BufferId, split_id: LeafId, )

Close tabs to the right of the specified buffer in a split

Source

pub fn close_tabs_to_left_in_split( &mut self, buffer_id: BufferId, split_id: LeafId, )

Close tabs to the left of the specified buffer in a split

Source

pub fn close_all_tabs_in_split(&mut self, split_id: LeafId)

Close all tabs in a split

Source

pub fn next_buffer(&mut self)

Switch to next buffer in current split’s tabs

Source

pub fn prev_buffer(&mut self)

Switch to previous buffer in current split’s tabs

Source

pub fn navigate_back(&mut self)

Navigate back in position history

Source

pub fn navigate_forward(&mut self)

Navigate forward in position history

Source§

impl Editor

Source

pub fn open_file_preview(&mut self, path: &Path) -> Result<BufferId>

Open a file in “preview” (ephemeral) mode and return its buffer ID.

Used for exploratory single-click opens from the file explorer. If the file_explorer.preview_tabs setting is disabled, this is equivalent to open_file.

Semantics (see Editor::preview for the full invariants):

  • Preview is anchored to a specific split. At most one preview exists editor-wide.
  • If the file is already open (deduped by canonical path, including symlinks and relative paths, by delegating to open_file_no_focus), just switch to it. No preview-state changes in either direction.
  • Otherwise, if there’s an existing preview in the same target split, close it and replace it. If it’s in a different split, promote it (walking away is commitment) and start a fresh preview in the target split.
  • Skips writing to position history, so a string of exploratory clicks doesn’t flood back/forward navigation with stale entries.

TODO(perf): Each preview swap today triggers LSP didClose + didOpen. For heavy language servers (rust-analyzer, tsserver) that’s wasteful on rapid browsing. A future optimization is to keep the LSP session for the outgoing buffer until the user commits to the new one.

Source

pub fn open_buffer_count(&self) -> usize

Number of open buffers (including hidden/virtual buffers). Intended for tests that verify preview tabs don’t accumulate.

Source

pub fn goto_line_col(&mut self, line: usize, column: Option<usize>)

Navigate to a specific line and column in the active buffer.

Line and column are 1-indexed (matching typical editor conventions). If the line is out of bounds, navigates to the last line. If the column is out of bounds, navigates to the end of the line.

Source

pub fn select_range( &mut self, start_line: usize, start_col: Option<usize>, end_line: usize, end_col: Option<usize>, )

Select a range in the active buffer. Lines/columns are 1-indexed. The cursor moves to the end of the range and the anchor is set to the start, producing a visual selection.

Source

pub fn goto_byte_offset(&mut self, offset: usize)

Go to an exact byte offset in the buffer (used in byte-offset mode for large files)

Source

pub fn new_buffer(&mut self) -> BufferId

Create a new empty buffer

Source

pub fn get_mouse_hover_state(&self) -> Option<(usize, u16, u16)>

Get the current mouse hover state for testing Returns Some((byte_position, screen_x, screen_y)) if hovering over text

Source

pub fn has_transient_popup(&self) -> bool

Check if a transient popup (hover/signature help) is currently visible

Source

pub fn force_check_mouse_hover(&mut self) -> bool

Force check the mouse hover timer (for testing) This bypasses the normal 500ms delay

Source§

impl Editor

Source

pub fn open_calibration_wizard(&mut self)

Open the calibration wizard

Source

pub fn save_calibration(&mut self, wizard: CalibrationWizard)

Save calibration and close wizard

Source

pub fn handle_calibration_input(&mut self, event: &KeyEvent) -> InputResult

Handle input when calibration wizard is active

Source

pub fn is_calibration_active(&self) -> bool

Check if calibration wizard is active

Source§

impl Editor

Source

pub fn copy_selection(&mut self)

Copy the current selection to clipboard

If no selection exists, copies the entire current line (like VSCode/Rider/Zed). For block selections, copies only the rectangular region.

Source

pub fn copy_selection_with_theme(&mut self, theme_name: &str)

Copy selection with a specific theme’s formatting

If theme_name is empty, opens a prompt to select a theme. Otherwise, copies the selected text as HTML with inline CSS styles.

Source

pub fn cut_selection(&mut self)

Cut the current selection to clipboard

If no selection exists, cuts the entire current line (like VSCode/Rider/Zed).

Source

pub fn paste(&mut self)

Paste the clipboard content at all cursor positions

Handles:

  • Single cursor paste
  • Multi-cursor paste (pastes at each cursor)
  • Selection replacement (deletes selection before inserting)
  • Atomic undo (single undo step for entire operation)
Source

pub fn paste_text(&mut self, paste_text: String)

Paste text directly into the editor

Handles:

  • Line ending normalization (CRLF/CR → buffer’s format)
  • Single cursor paste
  • Multi-cursor paste (pastes at each cursor)
  • Column-mode paste: when the cursor count equals the number of clipboard lines, each cursor receives a distinct line (matches VSCode/Notepad++ behavior, see issue #1057). This makes a block-selected copy/paste round-trip preserve its rectangular shape.
  • Selection replacement (deletes selection before inserting)
  • Atomic undo (single undo step for entire operation)
  • Routing to prompt if one is open
Source

pub fn copy_buffer_path(&mut self, buffer_id: BufferId, relative: bool)

Copy a buffer’s file path to the clipboard.

When relative is true the path is made relative to the workspace root; if the file lives outside the workspace the absolute path is used as a safe fallback (the user still gets a usable path rather than nothing). When relative is false the absolute path is always copied.

If the buffer has no associated file (unsaved scratch buffer) or the buffer id is unknown, a status message is shown and the clipboard is left untouched.

Source

pub fn copy_active_buffer_path(&mut self, relative: bool)

Copy the active buffer’s file path. See Self::copy_buffer_path.

Source

pub fn add_cursor_at_next_match(&mut self)

Add a cursor at the next occurrence of the selected text If no selection, first selects the entire word at cursor position.

When an active substring search has placed the cursor at a match (cursor inside search_state.matches[i]..matches[i] + match_lengths[i]), the search match is selected instead of the surrounding word. This way subsequent presses look for the search substring rather than the whole word, which would skip other substring occurrences (issue #1697).

Source

pub fn add_cursor_above(&mut self)

Add a cursor above the primary cursor at the same column

Source

pub fn add_cursor_below(&mut self)

Add a cursor below the primary cursor at the same column

Source

pub fn add_cursors_to_line_ends(&mut self)

Place a cursor at the end of every line covered by ANY existing cursor’s selection (or each cursor’s own line if it has no selection). Matches VSCode’s “Add Cursor to Line Ends” / Sublime’s “Split Selection into Lines”: every existing cursor contributes, no cursor is silently dropped. Two cursors on the same line collapse to a single cursor. All selections are cleared.

Source

pub fn yank_word_forward(&mut self)

Yank (copy) from cursor to next word start

Source

pub fn yank_vi_word_end(&mut self)

Yank (copy) from cursor to vim word end (inclusive)

Source

pub fn yank_word_backward(&mut self)

Yank (copy) from previous word start to cursor

Source

pub fn yank_to_line_end(&mut self)

Yank (copy) from cursor to end of line

Source

pub fn yank_to_line_start(&mut self)

Yank (copy) from start of line to cursor

Source§

impl Editor

Source

pub fn flush_layout(&mut self)

Force-materialize render-dependent state for all visible splits.

This is the editor’s equivalent of iOS layoutIfNeeded() or browser forced reflow. It ensures that CompositeViewState entries exist for any visible composite buffer, using the split’s current viewport dimensions. After calling this, commands like compositeNextHunk can safely read and modify view state that would otherwise only exist after the next render cycle.

Source

pub fn get_composite_view_state( &mut self, split_id: LeafId, buffer_id: BufferId, ) -> Option<&mut CompositeViewState>

Get or create composite view state for a split

Source

pub fn create_composite_buffer( &mut self, name: String, mode: String, layout: CompositeLayout, sources: Vec<SourcePane>, ) -> BufferId

Create a new composite buffer

§Arguments
  • name - Display name for the composite buffer (shown in tab)
  • mode - Mode for keybindings (e.g., “diff-view”)
  • layout - How panes are arranged (side-by-side, stacked, unified)
  • sources - Source panes to display
§Returns

The ID of the newly created composite buffer

Source

pub fn handle_composite_action( &mut self, buffer_id: BufferId, action: &Action, ) -> Option<bool>

Handle an action for a composite buffer.

For navigation and selection actions, this forwards to the focused source buffer and syncs scroll between panes. Returns Some(true) if handled, None to fall through to normal buffer handling.

Source§

impl Editor

Source

pub fn async_bridge(&self) -> Option<&AsyncBridge>

Get a reference to the async bridge (if available)

Source

pub fn config(&self) -> &Config

Get a reference to the config

Source

pub fn config_mut(&mut self) -> &mut Config

Get a mutable reference to the config.

Routes through Arc::make_mut: if the plugin state snapshot (or any other reader) still holds an Arc to the current value, this CoW-clones so existing readers observe a stable value and the next snapshot refresh sees a new pointer. Arc<T> has no DerefMut, so the only way to mutate through self.config is via this accessor — there is no code path that can silently leave a reader with stale data.

Window-side reads (Window::config()) read a separate Arc clone stashed in WindowResources. Mutations through config_mut therefore leave window clones stale until Editor::sync_windows_config runs. Callers that mutate a config field which Window code reads (e.g. editor.line_wrap, editor.enable_inlay_hints, languages, etc.) must call sync_windows_config() afterwards. set_config does this automatically.

Source

pub fn set_config(&mut self, new_config: Config)

Replace the config wholesale. Used by the “reload config” path and by tests that want to swap in a freshly-parsed file. Constructs a fresh Arc, so any snapshot that still holds the old value sees the pointer move and will reserialize on the next refresh.

Also propagates the new Arc to every window’s resources.config, so window-scoped reads see the swap.

Source

pub fn key_translator(&self) -> &KeyTranslator

Get a reference to the key translator (for input calibration)

Source

pub fn time_source(&self) -> &SharedTimeSource

Get a reference to the time source

Source

pub fn emit_event(&self, name: impl Into<String>, data: Value)

Emit a control event

Source

pub fn get_all_keybindings(&self) -> Vec<(String, String)>

Get all keybindings as (key, action) pairs

Source

pub fn get_keybinding_for_action(&self, action_name: &str) -> Option<String>

Get the formatted keybinding for a specific action (for display in messages) Returns None if no keybinding is found for the action

Source

pub fn keybinding_event_for_action( &self, action: &Action, context: KeyContext, ) -> Option<(KeyCode, KeyModifiers)>

Raw-event counterpart: return the (KeyCode, KeyModifiers) currently bound to action in context. Intended for callers that need to simulate the user pressing the bound key (e2e tests, some hotkey- chaining code) without hardcoding a default that a user’s rebind would invalidate.

Source

pub fn mode_registry_mut(&mut self) -> &mut ModeRegistry

Get mutable access to the mode registry

Source

pub fn mode_registry(&self) -> &ModeRegistry

Get immutable access to the mode registry

Source

pub fn active_buffer(&self) -> BufferId

Get the currently active buffer ID.

This is derived from the split manager (single source of truth). The editor always has at least one buffer, so this never fails.

When the active split has a buffer-group tab as its active target (i.e., active_group_tab.is_some()), this returns the buffer of the currently-focused inner panel — so that input routing, command palette context, buffer mode, and other “what is the user looking at” queries resolve to the panel the user is actually interacting with rather than the split’s background leaf buffer.

The override only takes effect if the inner panel’s buffer is still live in self.buffers; otherwise it falls back to the main split’s leaf buffer so callers never see a stale/freed buffer id.

Source

pub fn effective_active_split(&self) -> LeafId

The split id whose SplitViewState owns the currently-focused cursors/viewport/buffer state. For a regular split this is just split_manager.active_split(). For a split that has a group tab active, this returns the focused inner panel’s leaf id (which lives in split_view_states even though it’s not in the main split tree).

Source

pub fn active_buffer_mode(&self) -> Option<&str>

Get the mode name for the active buffer.

Resolution order:

  1. The buffer’s own virtual-buffer mode, if it has one.
  2. The mode declared by the buffer-group containing this buffer (e.g. a git-log group’s keybindings apply to its panels regardless of whether each panel is a virtual buffer or a file-backed one — openFileStreaming produces the latter for streaming detail panels).
Source

pub fn is_active_buffer_read_only(&self) -> bool

Check if the active buffer is read-only

Source

pub fn effective_mode(&self) -> Option<&str>

Get the effective mode for the active buffer.

Buffer-local mode (virtual buffers) takes precedence over the global editor mode, so that e.g. a search-replace panel isn’t hijacked by a markdown-source or vi-mode global mode.

Source

pub fn global_popups(&self) -> &PopupManager

Read-only view of the editor-wide popup stack.

global_popups itself is pub(crate) so its internals stay private to the app module; tests need to inspect its depth / contents to verify “no two popups stacked across the buffer- local and global stacks” invariants (e.g. issue 1 of the LSP indicator-click bugs), so we expose an immutable accessor here.

Source

pub fn next_periodic_redraw_deadline(&self) -> Option<Instant>

The earliest wall-clock deadline at which the main event loop needs to wake up and re-render, purely because of internal time-driven UI elements (animations, the LSP status-bar spinner). Returns None when no time-driven UI is in flight — the loop can sleep until the next user / async event without missing a frame.

The Some case includes the LSP-progress spinner: its glyph is computed from SystemTime::now() / 100ms, so the loop has to wake at ~100ms cadence to actually advance it. Without this signal, the indicator would only tick when an unrelated event caused a frame, and the user would see a “frozen” spinner whenever the server stopped emitting $/progress (e.g. died externally — see #1941 issue 3).

Source

pub fn get_stored_diagnostics(&self) -> &HashMap<String, Vec<Diagnostic>>

Get stored LSP diagnostics (for testing and external access) Returns a reference to the diagnostics map keyed by file URI

Source

pub fn is_update_available(&self) -> bool

Check if an update is available

Source

pub fn latest_version(&self) -> Option<&str>

Get the latest version string if an update is available

Source

pub fn get_update_result(&self) -> Option<&ReleaseCheckResult>

Get the cached release check result (for shutdown notification)

Source

pub fn set_lsp_config(&mut self, language: String, config: Vec<LspServerConfig>)

Configure LSP server for a specific language

Source

pub fn set_warning_log(&mut self, receiver: Receiver<()>, path: PathBuf)

Set up warning log monitoring

When warnings/errors are logged, they will be written to the specified path and the editor will be notified via the receiver.

Source

pub fn take_warning_log(&mut self) -> Option<(Receiver<()>, PathBuf)>

Take the warning-log receiver+path out of this editor.

The receiver is single-consumer and lives for the process’s lifetime; on a destructive editor restart (e.g. authority swap) main.rs lifts it from the old editor and re-installs it on the new one so warnings keep flowing post-restart instead of vanishing with the dropped editor.

Source

pub fn set_status_log_path(&mut self, path: PathBuf)

Set the status message log path

Source

pub fn install_authority(&mut self, authority: Authority)

Queue a new authority and restart the editor.

Per the design decision in docs/internal/AUTHORITY_DESIGN.md, authority transitions piggy-back on the existing change_working_dir restart path. The caller never sees an editor that is half-transitioned: the current Editor is dropped, main.rs rebuilds a fresh one with the queued authority, and session restore reopens buffers against the new backend. This is slower than an in-place pointer swap but is far more robust — every cached Arc<dyn FileSystem>, LSP handle, terminal PTY, plugin state, and in-flight task is dropped cleanly by the existing restart machinery.

Source

pub fn clear_authority(&mut self)

Restore the default local authority. Same destructive-restart semantics as install_authority — the caller never observes a half-transitioned editor.

Source

pub fn take_pending_authority(&mut self) -> Option<Authority>

Take the queued authority (if any). Called by main.rs on restart to move the queued authority into the fresh editor.

Source

pub fn set_boot_authority(&mut self, authority: Authority)

Directly replace the active authority without triggering a restart. Intended for the post-construction wiring in main.rs only, where the editor is still being set up and there is no user-visible state to preserve. Do not call this from the event loop — use install_authority for that.

Also refreshes the plugin state snapshot so hooks that fire after this call (notably plugins_loaded, fired by main.rs right after set_boot_authority) see the real authority_label instead of the empty string the temporary Authority::local() carried during construction.

Source

pub fn authority(&self) -> &Authority

Read-only access to the active authority.

Source

pub fn working_dir(&self) -> &Path

The editor’s current working directory — the active window’s project root. Derived, not stored: there is no separate working_dir field that could drift out of sync with the active window (issue #2056). Individual buffers may live elsewhere.

Source

pub fn active_window(&self) -> &Window

The currently active Session. Always WindowId(1) until the multi-session migration step lands; until then this is effectively a typed wrapper around working_dir. New code should prefer this accessor so the eventual migration is a no-op for the call site.

Panics if the active session id is not present in the sessions map. That invariant is upheld by the constructor and setActiveWindow (when added) — if the panic ever fires it indicates a bug in session lifecycle code.

Source

pub fn active_session_id(&self) -> WindowId

The active session’s id.

Source

pub fn session_count(&self) -> usize

Number of sessions currently in the editor. Always 1 until the multi-session step lands.

Source

pub fn session(&self, id: WindowId) -> Option<&Window>

Look up a session by id. Returns None if id is not in the sessions map. Useful for tests; production code that needs the active session should use active_window().

Source

pub fn active_window_mut(&mut self) -> &mut Window

Mutable access to the active session. Used by lifecycle code that re-targets per-session state (renaming, etc.). Same panic invariant as active_window().

Source

pub fn file_explorer(&self) -> Option<&FileTreeView>

Active window’s file-explorer view (None if it’s never been opened in this window). Each window has its own tree; switching windows shows that window’s view (or none).

Source

pub fn file_explorer_mut(&mut self) -> Option<&mut FileTreeView>

Mutable handle to the active window’s file-explorer view. Holds &mut self for the call’s lifetime — for sites that also need to read other Editor fields, use direct self.windows.get_mut(&self.active_window).and_then(|w| w.file_explorer.as_mut()) instead so the borrow on self.windows stays disjoint.

Source

pub fn buffer_ids_under_path(&self, root: &Path) -> Vec<BufferId>

Return buffer ids whose on-disk path sits at or under root. Used by file-explorer operations that need to react when a file or directory on disk goes away or moves.

Source

pub fn remote_connection_info(&self) -> Option<&str>

Get remote connection info if editing remote files

Returns Some("user@host") for remote editing, None for local.

Source

pub fn connection_display_string(&self) -> Option<String>

Get connection string for display in status bar and file explorer.

Per principle 9, identity lives in the authority. The label set by whoever constructed the authority wins; if it is empty (the SSH constructor leaves it that way) we fall back to the filesystem’s remote_connection_info(), which knows how to annotate disconnected SSH sessions.

Source

pub fn get_status_log_path(&self) -> Option<&PathBuf>

Get the status log path

Source

pub fn open_status_log(&mut self)

Open the status log file (user clicked on status message)

Source

pub fn check_warning_log(&mut self) -> bool

Check for and handle any new warnings in the warning log

Updates the general warning domain for the status bar. Returns true if new warnings were found.

Source

pub fn open_warning_log(&mut self)

Get the warning domain registry Open the warning log file (user-initiated action). Stays on impl Editor because it calls editor-orchestration helpers (open_local_file, mark_buffer_read_only).

Source

pub fn check_mouse_hover_timer(&mut self) -> bool

Check if mouse hover timer has expired and trigger LSP hover request

This implements debounced hover - we wait for the configured delay before sending the request to avoid spamming the LSP server on every mouse move. Returns true if a hover request was triggered.

Source

pub fn check_completion_trigger_timer(&mut self) -> bool

Check if completion trigger timer has expired and trigger completion if so

This implements debounced completion - we wait for quick_suggestions_delay_ms before sending the completion request to avoid spamming the LSP server. Returns true if a completion request was triggered.

Source§

impl Editor

Source

pub fn new( config: Config, width: u16, height: u16, dir_context: DirectoryContext, color_capability: ColorCapability, filesystem: Arc<dyn FileSystem + Send + Sync>, ) -> AnyhowResult<Self>

Create a new editor with the given configuration and terminal dimensions Uses system directories for state (recovery, sessions, etc.)

Source

pub fn with_working_dir( config: Config, width: u16, height: u16, working_dir: Option<PathBuf>, dir_context: DirectoryContext, plugins_enabled: bool, color_capability: ColorCapability, filesystem: Arc<dyn FileSystem + Send + Sync>, ) -> AnyhowResult<Self>

Create a new editor with an explicit working directory This is useful for testing with isolated temporary directories

Source

pub fn with_working_dir_opts( config: Config, width: u16, height: u16, working_dir: Option<PathBuf>, dir_context: DirectoryContext, plugins_enabled: bool, color_capability: ColorCapability, filesystem: Arc<dyn FileSystem + Send + Sync>, defer_plugin_load: bool, ) -> AnyhowResult<Self>

Like Self::with_working_dir but with defer_plugin_load exposed. When true, plugin loading is dispatched to the plugin thread and the constructor returns immediately; results arrive later via AsyncMessage::PluginsDirLoaded / PluginDeclarationsReady and are applied in process_async_messages. Used by the TUI startup path so the first frame draws without waiting on TS parse/transpile/register.

Source

pub fn for_test( config: Config, width: u16, height: u16, working_dir: Option<PathBuf>, dir_context: DirectoryContext, color_capability: ColorCapability, filesystem: Arc<dyn FileSystem + Send + Sync>, time_source: Option<SharedTimeSource>, grammar_registry: Option<Arc<GrammarRegistry>>, enable_plugins: bool, enable_embedded_plugins: bool, ) -> AnyhowResult<Self>

Create a new editor for testing with custom backends

By default uses empty grammar registry for fast initialization. Pass Some(registry) for tests that need syntax highlighting or shebang detection.

enable_plugins controls whether the plugin runtime is active at all. enable_embedded_plugins separately gates the cargo-binstall embedded plugins fallback — tests that pre-populate <config_dir>/plugins/ and want exact control over which plugins load can pass false here while keeping enable_plugins = true.

Source

pub fn event_broadcaster(&self) -> &EventBroadcaster

Get a reference to the event broadcaster

Source

pub fn load_init_script(&mut self, enabled: bool)

Auto-load ~/.config/fresh/init.ts if present, through the existing plugin pipeline under the stable name crate::init_script::INIT_PLUGIN_NAME.

Source

pub fn load_init_script_async(&mut self, enabled: bool)

Non-blocking variant of Self::load_init_script for the TUI startup path. Does the synchronous pre-work (types scaffolding refresh, syntax check, fuse check), then either submits the LoadPluginFromSource request to the plugin thread and spawns a forwarder that translates the result into AsyncMessage::PluginInitScriptLoaded, or — for the Skip(...) outcomes — emits the message directly so the same async-dispatch handler logs and applies status. The request goes through the same FIFO channel as the startup plugin loads, so by the time the plugin thread evaluates init.ts every batch plugin has already finished — preserving the original load ordering.

Source

pub fn handle_set_setting(&mut self, path: String, value: Value)

Handle setSetting(path, value). Fire-and-forget: patches Config directly via JSON round-trip. No overlay, no per-plugin tracking, no revert on unload — same model as Neovim/VS Code/Emacs/Sublime.

Source

pub fn handle_add_plugin_config_field( &mut self, plugin_name: String, field_name: String, field_schema: Value, )

Append a single config field to a plugin’s accumulated schema and pre-populate its default value. Each defineConfigX(...) call from the plugin’s TS code fires one of these.

On first call for a plugin we synthesise a fresh {"type": "object", "properties": {}} schema and grow it as more fields arrive. Re-registering the same field_name overwrites the previous definition (which is what we want on plugin reload — plugins re-run their defineConfigX calls).

Source

pub fn fire_plugins_loaded_hook(&self)

Fire the plugins_loaded hook (design M2, §3.3 phase 2).

Source

pub fn fire_ready_hook(&self)

Fire the ready hook (design M2, §3.3 phase 3).

Source§

impl Editor

Source

pub fn log_and_apply_event(&mut self, event: &Event)

All event applications MUST go through this method to ensure consistency. Log an event and apply it to the active buffer. For Delete events, captures displaced marker positions before applying so undo can restore them to their exact original positions.

Source

pub fn apply_event_to_active_buffer(&mut self, event: &Event)

Source

pub fn apply_events_as_bulk_edit( &mut self, events: Vec<Event>, description: String, ) -> Option<Event>

Apply multiple Insert/Delete events efficiently using bulk edit optimization.

This avoids O(n²) complexity by:

  1. Converting events to (position, delete_len, insert_text) tuples
  2. Applying all edits in a single tree pass via apply_bulk_edits
  3. Creating a BulkEdit event for undo (stores tree snapshot via Arc clone = O(1))
§Arguments
  • events - Vec of Insert/Delete events (sorted by position descending for correct application)
  • description - Description for the undo log
§Returns

The BulkEdit event that was applied, for tracking purposes

Source§

impl Editor

Source

pub fn file_explorer_visible(&self) -> bool

Source

pub fn toggle_file_explorer(&mut self)

Source

pub fn show_file_explorer(&mut self)

Source

pub fn focus_file_explorer(&mut self)

Source

pub fn file_explorer_navigate_up(&mut self)

Source

pub fn file_explorer_navigate_down(&mut self)

Source

pub fn file_explorer_page_up(&mut self)

Source

pub fn file_explorer_page_down(&mut self)

Source

pub fn file_explorer_collapse(&mut self)

Collapse behavior for left arrow:

  • If on expanded directory: collapse it
  • If on file or collapsed directory: select parent directory
Source

pub fn file_explorer_toggle_expand(&mut self)

Source

pub fn file_explorer_open_file(&mut self) -> AnyhowResult<()>

Source

pub fn file_explorer_refresh(&mut self)

Source

pub fn file_explorer_new_file(&mut self)

Source

pub fn file_explorer_new_directory(&mut self)

Source

pub fn file_explorer_delete(&mut self)

Source

pub fn perform_file_explorer_delete(&mut self, path: PathBuf, _is_dir: bool)

Perform the actual file explorer delete operation (called after prompt confirmation) For local files: moves to system trash/recycle bin For remote files: moves to ~/.local/share/fresh/trash/ on remote

Source

pub fn file_explorer_rename(&mut self)

Source

pub fn perform_file_explorer_rename( &mut self, original_path: PathBuf, original_name: String, new_name: String, is_new_file: bool, )

Perform the actual file explorer rename operation (called after prompt confirmation)

Source

pub fn file_explorer_toggle_hidden(&mut self)

Source

pub fn file_explorer_toggle_gitignored(&mut self)

Source

pub fn file_explorer_paste(&mut self)

Clear the file explorer search (or multi-selection, pending cut, or transfer focus)

Source

pub fn perform_file_explorer_paste( &mut self, src: PathBuf, dst: PathBuf, is_cut: bool, )

Source

pub fn file_explorer_duplicate(&mut self)

Duplicate the selected file/directory in-place, naming the new copy using the same name copy[.ext] convention as Paste’s auto-rename.

Multi-selection duplicates each item independently; the project root is skipped (you can’t duplicate the project root itself).

Source

pub fn file_explorer_copy_path(&mut self, relative: bool)

Copy the selected node’s path(s) to the clipboard.

relative=true strips working_dir from each path when it is a prefix; otherwise the absolute path is used. Multiple selections are joined by newlines, in the same visible order shown by the tree, so the result is friendly for pasting into a shell or list.

Source§

impl Editor

Source

pub fn is_file_open_active(&self) -> bool

Check if the file open dialog is active (for OpenFile, SwitchProject, or SaveFileAs)

Source

pub fn handle_file_open_action(&mut self, action: &Action) -> bool

Handle action for file open dialog Returns true if the action was handled, false if it should be passed to normal prompt handling

Source

pub fn start_large_file_encoding_confirmation( &mut self, confirmation: &LargeFileEncodingConfirmation, )

Start the large file encoding confirmation prompt.

This is called when opening a file that has a non-resynchronizable encoding (like GBK, GB18030, Shift-JIS) and the file is large enough to require user confirmation before loading the entire file into memory.

Source

pub fn start_open_file_with_encoding_prompt(&mut self, path: PathBuf)

Start the encoding selection prompt for opening a file

Source

pub fn update_file_open_filter(&mut self)

Update filter when prompt text changes

Source

pub fn file_open_toggle_sort(&mut self, mode: SortMode)

Handle sorting toggle (called from keybinding)

Source

pub fn file_open_toggle_hidden(&mut self)

Handle hidden files toggle

Source

pub fn file_open_toggle_detect_encoding(&mut self)

Handle encoding detection toggle

Source

pub fn handle_file_open_scroll(&mut self, delta: i32) -> bool

Handle mouse wheel scroll in file browser Returns true if the scroll was handled

Source

pub fn handle_file_open_click(&mut self, x: u16, y: u16) -> bool

Handle mouse click in file browser

Source

pub fn handle_file_open_double_click(&mut self, x: u16, y: u16) -> bool

Handle double-click in file browser

Source

pub fn compute_file_browser_hover(&self, x: u16, y: u16) -> Option<HoverTarget>

Compute hover target for file browser

Source§

impl Editor

Source

pub fn open_file(&mut self, path: &Path) -> Result<BufferId>

Open a file and return its buffer ID

If the file doesn’t exist, creates an unsaved buffer with that filename. Saving the buffer will create the file.

Source

pub fn open_file_no_focus(&mut self, path: &Path) -> Result<BufferId>

If the active split leaf carries SplitRole::UtilityDock, move the active leaf back to the user’s last regular editor leaf. 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.

Routing falls back to the first non-dock leaf in tree order when the user has only ever interacted with the dock — a rare boot-state path. Open a file without switching focus to it

Creates a new buffer for the file (or returns existing buffer ID if already open) but does not change the active buffer. Useful for opening files in background tabs.

If the file doesn’t exist, creates an unsaved buffer with that filename.

Thin delegator: the open-file core lives on impl Window (rooted at the window’s own root / resources). The editor forwards to the active window.

Source

pub fn open_file_with_encoding( &mut self, path: &Path, encoding: Encoding, ) -> Result<BufferId>

Open a file with a specific encoding (no auto-detection).

Used when the user disables auto-detection in the file browser and selects a specific encoding to use.

Source

pub fn reload_with_encoding(&mut self, encoding: Encoding) -> Result<()>

Reload the current file with a specific encoding.

Requires the buffer to have no unsaved modifications.

Source

pub fn open_file_large_encoding_confirmed( &mut self, path: &Path, ) -> Result<BufferId>

Open a large file with confirmed full loading for non-resynchronizable encoding.

Called after user confirms they want to load a large file with an encoding like GB18030, GBK, Shift-JIS, or EUC-KR that requires loading the entire file into memory.

Source§

impl Editor

Source

pub fn schedule_hot_exit_recovery(&mut self)

Queue a file to be opened after the TUI starts.

This is used for CLI file arguments to ensure they go through the same code path as interactive file opens, providing consistent error handling (e.g., encoding confirmation prompts are shown in the UI instead of crashing). Schedule hot exit recovery to run after the next batch of pending file opens.

Source

pub fn queue_file_open( &mut self, path: PathBuf, line: Option<usize>, column: Option<usize>, end_line: Option<usize>, end_column: Option<usize>, message: Option<String>, wait_id: Option<u64>, )

Source

pub fn process_pending_file_opens(&mut self) -> bool

Process pending file opens (called from the event loop).

Opens files that were queued during startup, using the same error handling as interactive file opens. Returns true if any files were processed.

Source

pub fn take_completed_waits(&mut self) -> Vec<u64>

Take and return completed wait IDs (for –wait support).

Source

pub fn remove_wait_tracking(&mut self, wait_id: u64)

Remove wait tracking for a given wait_id (e.g., when waiting client disconnects).

Source§

impl Editor

Source

pub fn save(&mut self) -> Result<()>

Save the active buffer

Source

pub fn auto_save_persistent_buffers(&mut self) -> Result<usize>

Auto-save all modified buffers to their original files on disk Returns the number of buffers saved

Source

pub fn save_all_on_exit(&mut self) -> Result<usize>

Save all modified file-backed buffers to disk (called on exit when auto_save is enabled). Unlike auto_save_persistent_buffers, this skips the interval check and only saves named file-backed buffers (not unnamed buffers).

Source

pub fn revert_file(&mut self) -> Result<bool>

Revert the active buffer to the last saved version on disk Returns Ok(true) if reverted, Ok(false) if no file path, Err on failure

Source

pub fn toggle_auto_revert(&mut self)

Toggle auto-revert mode

Source

pub fn poll_file_changes(&mut self) -> bool

Poll for file changes (called from main loop)

Checks modification times of open files to detect external changes. Returns true if any file was changed (requires re-render).

To avoid blocking the event loop, metadata checks run on a background thread. This method launches a poll if the interval has elapsed and no poll is already in flight, then checks for results from a prior poll.

Source

pub fn poll_file_tree_changes(&mut self) -> bool

Poll for file tree changes (called from main loop)

Checks modification times of expanded directories to detect new/deleted files. Returns true if any directory was refreshed (requires re-render).

Like poll_file_changes, metadata checks run on a background thread to avoid blocking the event loop.

Source

pub fn refresh_file_tree_dirs(&mut self, paths: &[PathBuf])

Re-read the given directories in the file explorer, preserving descendant expansion state and the cursor’s path.

Why reload_expanded_node and not refresh_node: refresh_node collapses the directory and re-expands it, which recycles every descendant NodeId and drops their expansion state. That’s fatal for this code path, which runs unprompted from a background timer: after a cut+paste into the workspace root, the source parent’s mtime changes, we land here seconds later, and refresh_node would collapse a user-expanded subtree and invalidate the cursor NodeId (after which Up/Down become no-ops because select_next/select_prev can’t find the current id in the visible list).

We also snapshot the cursor path before the reload and re-resolve it afterwards. reload_expanded_node still recycles ids under the refreshed root, so the old id is gone; the path survives unless the underlying file was deleted, in which case we fall back to the root so the cursor stays live and visible (a stale id is effectively no cursor at all).

Exposed as pub so tests can drive the refresh path directly without relying on filesystem mtime detection, which is too environment-sensitive (especially across CI filesystems).

Source

pub fn handle_file_changed(&mut self, changed_path: &str)

Handle a file change notification (from file watcher)

Source

pub fn check_save_conflict(&self) -> Option<SystemTime>

Check if saving would overwrite changes made by another process Returns Some(current_mtime) if there’s a conflict, None otherwise

Source§

impl Editor

Source

pub fn get_key_context(&self) -> KeyContext

Determine the current keybinding context based on UI state

Source

pub fn handle_key( &mut self, code: KeyCode, modifiers: KeyModifiers, ) -> AnyhowResult<()>

Handle a key event and return whether it was handled This is the central key handling logic used by both main.rs and tests

Source§

impl Editor

Source

pub fn dispatch_terminal_input( &mut self, event: &KeyEvent, ) -> Option<InputResult>

Dispatch input when in terminal mode.

Returns Some(InputResult) if terminal mode handled the input, None if not in terminal mode or if a modal is active.

Source

pub fn dispatch_modal_input(&mut self, event: &KeyEvent) -> Option<InputResult>

Dispatch input to the appropriate modal handler.

Returns Some(InputResult) if a modal handled the input, None if no modal is active and input should be handled normally.

Source

pub fn process_deferred_actions(&mut self, ctx: InputContext)

Process deferred actions collected during input handling.

Source§

impl Editor

Source

pub fn open_keybinding_editor(&mut self)

Open the keybinding editor modal

Source

pub fn handle_keybinding_editor_input( &mut self, event: &KeyEvent, ) -> InputResult

Handle input when keybinding editor is active

Source

pub fn is_keybinding_editor_active(&self) -> bool

Check if keybinding editor is active

Source

pub fn handle_keybinding_editor_mouse( &mut self, mouse_event: MouseEvent, ) -> Result<bool>

Handle mouse events when keybinding editor is active Returns Ok(true) if a re-render is needed

Source§

impl Editor

Source

pub fn should_quit(&self) -> bool

Check if the editor should quit

Source

pub fn should_detach(&self) -> bool

Check if the client should detach (keep server running)

Source

pub fn clear_detach(&mut self)

Clear the detach flag (after processing)

Source

pub fn set_session_mode(&mut self, session_mode: bool)

Set session mode (use hardware cursor only, no REVERSED style for software cursor)

Source

pub fn is_session_mode(&self) -> bool

Check if running in session mode

Source

pub fn set_software_cursor_only(&mut self, enabled: bool)

Mark that the backend does not render a hardware cursor. When set, the renderer always draws a software cursor indicator.

Source

pub fn set_session_name(&mut self, name: Option<String>)

Set the session name for display in status bar.

When a session name is set, the recovery service is reinitialized to use a session-scoped recovery directory so each named session’s recovery data is isolated.

Source

pub fn session_name(&self) -> Option<&str>

Get the session name (for status bar display)

Source

pub fn queue_escape_sequences(&mut self, sequences: &[u8])

Queue escape sequences to be sent to the client (session mode only)

Source

pub fn take_pending_escape_sequences(&mut self) -> Vec<u8>

Take pending escape sequences, clearing the queue

Source

pub fn take_pending_clipboard(&mut self) -> Option<PendingClipboard>

Take pending clipboard data queued in session mode, clearing the request

Source

pub fn should_restart(&self) -> bool

Check if the editor should restart with a new working directory

Source

pub fn take_restart_dir(&mut self) -> Option<PathBuf>

Take the restart directory, clearing the restart request Returns the new working directory if a restart was requested

Source

pub fn request_full_redraw(&mut self)

Request the editor to restart with a new working directory This triggers a clean shutdown and restart with the new project root Request a full hardware terminal clear and redraw on the next frame. Used after external commands have messed up the terminal state.

Source

pub fn take_full_redraw_request(&mut self) -> bool

Check if a full redraw was requested, and clear the flag.

Source

pub fn request_suspend(&mut self)

Request the event loop to suspend the editor process (SIGTSTP on Unix). The loop tears down terminal modes, raises the signal, then re-enables modes once the shell sends SIGCONT (e.g. via fg).

Source

pub fn take_suspend_request(&mut self) -> bool

Check if a suspend was requested, and clear the flag.

Source

pub fn request_restart(&mut self, new_working_dir: PathBuf)

Source

pub fn theme(&self) -> RwLockReadGuard<'_, Theme>

Get the active theme (read lock).

Source

pub fn is_settings_open(&self) -> bool

Check if the settings dialog is open and visible

Source

pub fn quit(&mut self)

Request the editor to quit

Source

pub fn focus_gained(&mut self)

Handle terminal focus gained event

Source

pub fn resize(&mut self, width: u16, height: u16)

Resize all buffers to match new terminal size. Loops over every Window so each one updates its own split viewports and visible terminal PTYs; the plugin resize hook fires once for the editor as a whole.

Source§

impl Editor

Source

pub fn handle_lsp_restart(&mut self)

Handle the LspRestart action.

For a single-server config, restarts immediately (no prompt). For multiple servers, shows a prompt to select which server(s) to restart.

Source

pub fn handle_lsp_stop(&mut self)

Handle the LspStop action.

Shows a prompt to select which LSP server to stop, with suggestions for all currently running servers.

Source

pub fn handle_lsp_toggle_for_buffer(&mut self)

Handle the LspToggleForBuffer action.

Toggles LSP on/off for the current buffer only. Requires an LSP server to be configured for the current buffer’s language.

Source

pub fn handle_lsp_status_action(&mut self, action_key: &str)

Handle an action from the LSP status details popup.

Action keys have the format:

  • restart:<language>/<server_name> — restart a specific server
  • start:<language> — start LSP server(s) for a language
  • stop:<language>/<server_name> — stop a specific server
  • log:<language> — open the LSP log file for the language
  • dismiss:<language> — hide the pill for this language (dim style)
  • enable:<language> — restore a dismissed language’s pill
  • autostart:<language>/<server_name> — flip auto_start=true for the named server in config, save, and start it now
  • cancel_popup — no-op here; the row exists purely so the user has an on-screen “Dismiss” affordance (close is handled upstream in handle_popup_confirm before this is called)
Source§

impl Editor

Source

pub fn request_hover(&mut self) -> AnyhowResult<()>

Request LSP hover documentation at current cursor position

Source

pub fn handle_rename_response( &mut self, _request_id: u64, result: Result<WorkspaceEdit, String>, ) -> AnyhowResult<()>

Handle rename response from LSP

Source§

impl Editor

Source

pub fn set_menus(&mut self, menus: MenuConfig)

Replace self.menus and invalidate the expanded-menu cache. Use this in place of a direct self.menus = … assignment so the cached DynamicSubmenu expansion can never go stale relative to the underlying menu config.

Source

pub fn with_menu_by_label<F, R>(&mut self, label: &str, f: F) -> Option<R>
where F: FnOnce(&mut Menu) -> R,

Find a built-in or plugin menu by label, mutate it via f, and invalidate the expanded-menu cache. Returns None if no matching menu was found (in which case the cache is left alone).

Source

pub fn handle_menu_activate(&mut self)

Handle MenuActivate action - opens the first menu. If the menu bar is hidden, it will be temporarily shown.

Source

pub fn close_menu_with_auto_hide(&mut self)

Close the menu and auto-hide the menu bar if it was temporarily shown. Use this method instead of menu_state.close_menu() to ensure auto-hide works.

Source

pub fn handle_menu_close(&mut self)

Handle MenuClose action - closes the active menu. If the menu bar was auto-shown, it will be hidden again.

Source

pub fn handle_menu_left(&mut self)

Handle MenuLeft action - close submenu or go to previous menu.

Source

pub fn handle_menu_right(&mut self)

Handle MenuRight action - open submenu or go to next menu.

Source

pub fn handle_menu_up(&mut self)

Handle MenuUp action - select previous item in menu.

Source

pub fn handle_menu_down(&mut self)

Handle MenuDown action - select next item in menu.

Source

pub fn handle_menu_execute(&mut self) -> Option<Action>

Handle MenuExecute action - execute highlighted item or open submenu.

Returns Some(action) if an action should be executed after this call.

Source

pub fn handle_menu_open(&mut self, menu_name: &str)

Handle MenuOpen action - open a specific menu by name. If the menu bar is hidden, it will be temporarily shown.

Source§

impl Editor

Source

pub fn menu_context(&self) -> MenuContext

Return a clone of the current menu context (boolean state flags).

This is used by the GUI layer to sync native menu item states (enabled/disabled, checkmarks) without knowing about the editor’s internal state.

Source

pub fn expanded_menu_definitions(&self) -> Vec<Menu>

Return the fully-expanded menu definitions (with DynamicSubmenu items resolved to Submenu). Used by the GUI layer to build platform-native menus.

Source

pub fn update_menu_context(&mut self)

Update all menu context values based on current editor state. This should be called before rendering the menu bar.

Source§

impl Editor

Source

pub fn handle_mouse(&mut self, mouse_event: MouseEvent) -> AnyhowResult<bool>

Handle a mouse event. Returns true if a re-render is needed.

Source§

impl Editor

Source

pub fn run_on_save_actions(&mut self) -> Result<bool, String>

Run on-save actions for the active buffer after a successful save. This includes format-on-save (if enabled) and any on_save actions. Returns Ok(true) if actions ran successfully, Ok(false) if no actions, or Err with an error message.

Source

pub fn format_buffer(&mut self) -> Result<(), String>

Format the current buffer using the configured formatter. Returns Ok(()) if formatting succeeded, or Err with an error message.

Source

pub fn trim_trailing_whitespace(&mut self) -> Result<bool, String>

Trim trailing whitespace from all lines in the active buffer. Returns Ok(true) if any changes were made, Ok(false) if buffer unchanged.

Source

pub fn ensure_final_newline(&mut self) -> Result<bool, String>

Ensure the buffer ends with a newline. Returns Ok(true) if a newline was added, Ok(false) if already ends with newline.

Source§

impl Editor

Source

pub fn save_orchestrator_state(&self)

Persist sessions + plugin_global_state to disk. Best- effort: filesystem errors are logged at WARN and swallowed so a transient permission glitch doesn’t block quit.

Source§

impl Editor

Source

pub fn handle_plugin_command( &mut self, command: PluginCommand, ) -> AnyhowResult<()>

Handle a plugin command - dispatches to specialized handlers in plugin_commands module

Source§

impl Editor

Source

pub fn handle_popup_confirm(&mut self) -> PopupConfirmResult

Handle PopupConfirm action.

Dispatches by reading the currently-focused popup’s PopupResolver — the popup itself carries its own “how do I confirm?” identity. This eliminates the old side-channel cascade where pending_X: Option<...> flags competed for precedence: two popups coexisting (e.g. plugin action popup on the global stack + LSP auto-prompt on the buffer stack) would race on whose flag the cascade hit first, and the wrong branch would claim the key.

Global popups shadow buffer popups for keyboard focus (see input_dispatch::dispatch_modal_input), so the confirm path picks the same popup: global first, then the active buffer.

Source

pub fn handle_popup_cancel(&mut self)

Handle PopupCancel action.

Mirrors handle_popup_confirm: dispatch on the focused popup’s PopupResolver. Each flavour does its own cleanup; no precedence between unrelated popup types.

Source

pub fn handle_popup_focus(&mut self)

Mark the topmost visible popup as focused so subsequent key events route into the popup’s input handler.

Editor-level (global) popups shadow buffer popups for keyboard focus, mirroring the priority encoded in dispatch_modal_input, so we focus whichever popup the user actually sees.

No-op when no popup is visible — the user pressing the focus-popup key with nothing to focus shouldn’t error or steal the keystroke from the buffer.

Source

pub fn handle_popup_type_char(&mut self, c: char)

Handle typing a character while completion popup is open. Inserts the character at every cursor and re-filters the completion list.

Routes through Action::InsertChar so multi-cursor edits land in lock- step with normal typing: secondary cursors stay in sync with the primary one (issue #1901) and a single bulk-edit goes into the undo log.

Source

pub fn handle_popup_backspace(&mut self)

Handle backspace while completion popup is open. Deletes one character behind every cursor and re-filters the completion list.

Routes through Action::DeleteBackward so multi-cursor edits stay in sync (issue #1901). The action handler already no-ops cursors at the start of the buffer.

Source§

impl Editor

Source

pub fn show_warnings_popup(&mut self)

Show warnings by opening the warning log file directly

If there are no warnings, shows a brief status message. Otherwise, opens the warning log file for the user to view.

Source

pub fn show_lsp_status_popup(&mut self)

Show LSP status popup with details about servers active for the current buffer. Lists each server with its status and provides actions: restart, stop, view log.

User-initiated (status-bar click, lsp_status action). The popup grabs focus on show because the user explicitly asked for it, matching the historical click-to-pick-action affordance.

Source

pub fn refresh_lsp_status_popup_if_open(&mut self)

Rebuild the LSP-status popup in place if it’s currently open.

Used when an async event (progress update, server state change) might change the popup’s contents — notably while rust-analyzer is indexing and emits $/progress every few hundred ms. Without this, the popup would freeze on the snapshot taken at open time while the status-bar spinner keeps moving, making them look disconnected.

Source

pub fn show_remote_indicator_popup(&mut self)

Show the Remote Indicator context menu popup.

The menu is context-aware based on the current authority state:

  • Local: offers “Attach to Dev Container” (when a devcontainer config is detectable) and “Open Dev Container Config”.
  • Connected (container): offers “Reopen Locally” (detach), “Rebuild Container”, and “Show Container Info”.
  • Connected (SSH): offers “Disconnect Remote” and “Show Info”.
  • Disconnected: offers “Reconnect” (best-effort) and “Go Local”.

Clicking the {remote} status-bar element a second time toggles the popup closed, matching the LSP-indicator affordance.

§Design note

Plugin-owned actions (attach, rebuild) are dispatched via Action::PluginAction so core code never names the devcontainer plugin directly. If the plugin isn’t loaded the action becomes a no-op with a status message, which is the same fallback every other plugin-command invocation site uses.

Source

pub fn handle_remote_indicator_action(&mut self, action_key: &str)

Dispatch the action selected from the Remote Indicator popup.

  • "detach"clear_authority() (falls back to local).
  • "clear_override" — drop the Remote Indicator override without changing the authority. Used by the FailedAttach “Reopen Locally” row: nothing to detach (no authority was ever installed), but the FailedAttach indicator should clear.
  • "plugin:<name>" — forwards to Action::PluginAction(name).
  • "cancel_popup" — no-op; the popup framework already closed the popup when the row was confirmed.
  • anything else — logged and ignored.
Source

pub fn maybe_prompt_workspace_trust(&mut self)

Show the trust prompt if this workspace is undecided and contains content whose execution trust matters (env files, project manifests, .sln/.csproj, …). No-op once a decision is recorded or when there’s nothing to gate. Called from every editor-startup path (in-process run and the session server) so the prompt fires regardless of launch mode.

Source

pub fn show_workspace_trust_popup(&mut self, cancellable: bool)

Show the workspace-trust prompt: a centered list asking how this project’s tooling should be treated. Surfaced on opening an untrusted project that contains executable content (env files, .csproj/.sln, …). The default-focused choice is the safe “Restricted” — dismissing with Escape leaves the project undecided (and re-asks next open), while selecting any row records the decision so the prompt stops appearing.

Source

pub fn handle_workspace_trust_action(&mut self, action_key: &str)

Dispatch the choice selected from the workspace-trust prompt. "trusted" / "restricted" / "blocked" set the level (persisted, and the editor restarts so the new policy applies to already-running tooling). Anything else is logged and ignored.

Source

pub fn show_file_message_popup(&mut self, message: &str)

Show a transient hover popup with the given message text, positioned below the cursor. Used for file-open messages (e.g. file.txt:10@"Look at this").

Source

pub fn get_text_properties_at_cursor(&self) -> Option<Vec<&TextProperty>>

Get text properties at the cursor position in the active buffer

Source§

impl Editor

Source

pub fn add_overlay( &mut self, namespace: Option<OverlayNamespace>, range: Range<usize>, face: OverlayFace, priority: i32, message: Option<String>, ) -> OverlayHandle

Add an overlay for decorations (underlines, highlights, etc.)

Source

pub fn remove_overlay(&mut self, handle: OverlayHandle)

Remove an overlay by handle

Source

pub fn remove_overlays_in_range(&mut self, range: Range<usize>)

Remove all overlays in a range

Source

pub fn clear_overlays(&mut self)

Clear all overlays

Source

pub fn show_popup(&mut self, popup: PopupData)

Show a popup window

Source

pub fn show_popup_with_resolver( &mut self, popup: PopupData, resolver: PopupResolver, )

Show a popup and attach a confirm/cancel resolver to it. The PopupData event doesn’t carry the resolver (it’s a view-layer concern that doesn’t need event-log replay); we set it on the resulting Popup immediately after show_popup pushes it.

Source

pub fn hide_popup(&mut self)

Hide the topmost popup

Source

pub fn clear_popups(&mut self)

Clear all popups

Source

pub fn dismiss_menu_popups_for_prompt(&mut self)

Dismiss popups that overlap with a new modal UI (a prompt opening, a status-bar indicator switching to a picker, etc.).

Targets menu-style popups (List / Action) on both the buffer-local and editor-wide stacks. Completion and Hover popups are intentionally left alone: a Completion popup is driven by typing into the very prompt that may have just opened (e.g. type-to-filter), and a Hover popup is a transient documentation overlay that the existing transient- dismiss logic already handles.

Use this before opening any prompt or other top-level picker so a previously-open LSP-Servers popup (or plugin action popup) doesn’t keep overlapping the new UI. The user-reported flow that motivated this is: LSP indicator popup open → click the language indicator → language picker prompt opens, LSP popup stays overlapping it. (#1941 follow-up)

Source

pub fn show_lsp_confirmation_popup(&mut self, language: &str)

Show the LSP confirmation popup for a language server

This displays a centered popup asking the user to confirm whether they want to start the LSP server for the given language.

Source

pub fn handle_lsp_confirmation_response( &mut self, language: &str, action: &str, ) -> bool

Handle the LSP confirmation popup response

This is called when the user confirms their selection in the LSP confirmation popup. It processes the response and starts the LSP server if approved.

language is read from the confirming popup’s PopupResolver (no side-channel), so handle_popup_confirm’s resolver match can call us directly with what it destructured out of the popup.

Source

pub fn has_pending_lsp_confirmation(&self) -> bool

Check if the topmost visible popup is the LSP confirmation popup. Used by callers that need to know “is an LSP confirm prompt currently in front of the user?” — e.g. the file-open queue waits on this instead of racing past the prompt.

Source

pub fn popup_select_next(&mut self)

Navigate popup selection (next item)

Source

pub fn popup_select_prev(&mut self)

Navigate popup selection (previous item)

Source

pub fn popup_page_down(&mut self)

Navigate popup (page down)

Source

pub fn popup_page_up(&mut self)

Navigate popup (page up)

Source§

impl Editor

Source

pub fn handle_prompt_confirm_input( &mut self, input: String, prompt_type: PromptType, selected_index: Option<usize>, ) -> PromptResult

Handle prompt confirmation based on the prompt type.

Returns a PromptResult indicating what the caller should do next.

Source

pub fn handle_stop_lsp_server(&mut self, input: &str)

Handle StopLspServer prompt confirmation.

Input format: "language" (stops all servers) or "language/server_name" (stops a specific server).

Source

pub fn handle_restart_lsp_server(&mut self, input: &str)

Handle RestartLspServer prompt confirmation.

Input format: "language" (restarts all enabled servers) or "language/server_name" (restarts a specific server).

Source§

impl Editor

Source

pub fn start_prompt(&mut self, message: String, prompt_type: PromptType)

Start a new prompt (enter minibuffer mode)

Source

pub fn start_prompt_with_suggestions( &mut self, message: String, prompt_type: PromptType, suggestions: Vec<Suggestion>, )

Start a new prompt with autocomplete suggestions

Source

pub fn start_prompt_with_initial_text( &mut self, message: String, prompt_type: PromptType, initial_text: String, )

Start a new prompt with initial text

Source

pub fn start_quick_open(&mut self)

Start Quick Open prompt with command palette as default

Source

pub fn start_quick_open_with_prefix(&mut self, prefix: &str)

Start Quick Open prompt with specified prefix

Source

pub fn change_working_dir(&mut self, new_path: PathBuf)

Change the working directory to a new path

This requests a full editor restart with the new working directory. The main loop will drop the current editor instance and create a fresh one pointing to the new directory. This ensures:

  • All buffers are cleanly closed
  • LSP servers are properly shut down and restarted with new root
  • Plugins are cleanly restarted
  • No state leaks between projects
Source

pub fn cancel_prompt(&mut self)

Cancel the current prompt and return to normal mode

Source

pub fn handle_prompt_scroll(&mut self, delta: i32) -> bool

Handle mouse wheel scroll in prompt with suggestions. Returns true if scroll was handled, false if no prompt is active or has no suggestions.

Source

pub fn confirm_prompt(&mut self) -> Option<(String, PromptType, Option<usize>)>

Get the confirmed input and prompt type, consuming the prompt For command palette, returns the selected suggestion if available, otherwise the raw input Returns (input, prompt_type, selected_index) Returns None if trying to confirm a disabled command

Source

pub fn is_prompting(&self) -> bool

Check if currently in prompt mode

Source

pub fn editor_mode(&self) -> Option<String>

Get the current global editor mode (e.g., “vi-normal”, “vi-insert”) Returns None if no special mode is active

Source

pub fn command_registry(&self) -> &Arc<RwLock<CommandRegistry>>

Get access to the command registry

Source

pub fn plugin_manager(&self) -> RwLockReadGuard<'_, PluginManager>

Get access to the plugin manager (read lock).

Callers should use editor.plugin_manager() instead of locking directly so they’re decoupled from the field’s Arc<RwLock<>> internals.

Source

pub fn plugin_manager_mut(&mut self) -> RwLockWriteGuard<'_, PluginManager>

Mutable access to the plugin manager (write lock).

Source

pub fn file_explorer_is_focused(&self) -> bool

Check if file explorer has focus

Source

pub fn prompt_input(&self) -> Option<&str>

Get current prompt input (for display)

Source

pub fn has_active_selection(&self) -> bool

Check if the active cursor currently has a selection

Source

pub fn prompt_mut(&mut self) -> Option<&mut Prompt>

Get mutable reference to prompt (for input handling)

Source

pub fn set_status_message(&mut self, message: String)

Set a status message to display in the active window’s status bar. Editor-side thin wrapper; per-window body lives in Window::set_status_message.

Source

pub fn get_status_message(&self) -> Option<&String>

Get the current status message

Source

pub fn get_plugin_errors(&self) -> &[String]

Get accumulated plugin errors (for test assertions) Returns all error messages that were detected in plugin status messages

Source

pub fn clear_plugin_errors(&mut self)

Clear accumulated plugin errors

Source

pub fn update_prompt_suggestions(&mut self)

Update prompt suggestions based on current input

Source§

impl Editor

Source

pub fn start_recovery_session(&mut self) -> AnyhowResult<()>

Start the recovery session (call on editor startup after recovery check)

Source

pub fn end_recovery_session(&mut self) -> AnyhowResult<()>

End the recovery session cleanly (call on normal shutdown)

Source

pub fn has_recovery_files(&self) -> AnyhowResult<bool>

Check if there are files to recover from a crash

Source

pub fn list_recoverable_files(&self) -> AnyhowResult<Vec<RecoveryEntry>>

Get list of recoverable files

Source

pub fn recover_all_buffers(&mut self) -> AnyhowResult<usize>

Recover all buffers from recovery files Returns the number of buffers recovered

Source

pub fn discard_all_recovery(&mut self) -> AnyhowResult<usize>

Discard all recovery files (user decided not to recover) Returns the number of recovery files deleted

Source

pub fn try_restore_hot_exit_buffers(&mut self) -> AnyhowResult<usize>

Restore only the hot-exit content from the previous clean exit: files with unsaved modifications and unnamed buffers that held content. Called when full session restore is opted out (via --no-restore or editor.restore_previous_session = false) so the user does not lose in-progress work just because they asked to skip restoring the workspace layout.

Unlike Editor::recover_all_buffers, this path uses load_recovery and leaves the recovery files in place so the current session’s hot-exit pipeline keeps owning them (the files are cleaned up on the next clean shutdown via end_session_preserving).

Returns the number of buffers restored.

Source

pub fn auto_recovery_save_dirty_buffers(&mut self) -> AnyhowResult<usize>

Perform auto-recovery-save for all modified buffers if needed. Called frequently (every frame); rate-limited by auto_recovery_save_interval_secs.

Source

pub fn is_active_buffer_recovery_dirty(&self) -> bool

Check if the active buffer is marked dirty for auto-recovery-save Used for testing to verify that edits properly trigger recovery tracking

Source

pub fn delete_buffer_recovery( &mut self, buffer_id: BufferId, ) -> AnyhowResult<()>

Delete recovery for a buffer (call after saving or closing)

Source§

impl Editor

Source

pub fn render(&mut self, frame: &mut Frame<'_>)

Render the editor to the terminal

Source

pub fn recompute_layout(&mut self, width: u16, height: u16)

Recompute the view_line_mappings layout without drawing. Used during macro replay so that visual-line movements (MoveLineEnd, MoveUp, MoveDown on wrapped lines) see correct, up-to-date layout information between each replayed action.

Source

pub fn clear_search_history(&mut self)

Clear the search history Used primarily for testing to ensure test isolation

Source

pub fn save_histories(&self)

Save all prompt histories to disk Called on shutdown to persist history across sessions

Source§

impl Editor

Source

pub fn start_incremental_line_scan(&mut self, open_goto_line: bool)

Start an incremental line-feed scan for the active buffer.

Shared by the Action::ScanLineIndex command and the Go to Line scan confirmation prompt. Seeds LineScan so that process_line_scan will advance the scan one batch per frame.

When open_goto_line is true (Go to Line flow), the Go to Line prompt opens automatically when the scan completes.

Source

pub fn process_line_scan(&mut self) -> bool

Process chunks for the incremental line-feed scan. Returns true if the UI should re-render (progress updated or scan finished).

Source

pub fn process_search_scan(&mut self) -> bool

Process chunks for the incremental search scan. Returns true if the UI should re-render (progress updated or scan finished).

Source§

impl Editor

Source

pub fn open_settings(&mut self)

Open the settings modal

Source

pub fn close_settings(&mut self, save: bool)

Close the settings modal

If save is true and there are changes, they will be applied first.

Source

pub fn save_settings(&mut self)

Save the settings from the modal to config

Source

pub fn open_config_file(&mut self, layer: ConfigLayer) -> AnyhowResult<()>

Open the config file for the specified layer in the editor. Creates the file with default template if it doesn’t exist. If there are pending changes in the Settings UI, warns the user and doesn’t proceed.

Source

pub fn settings_navigate_up(&mut self)

Navigate settings up

Source

pub fn settings_navigate_down(&mut self)

Navigate settings down

Source

pub fn settings_activate_current(&mut self)

Activate/toggle the currently selected setting

Source

pub fn settings_increment_current(&mut self)

Increment the current setting value (for Number and Dropdown controls)

Source

pub fn settings_decrement_current(&mut self)

Decrement the current setting value (for Number and Dropdown controls)

Source§

impl Editor

Source

pub fn start_shell_command_prompt(&mut self, replace: bool)

Start a shell command prompt. If replace is true, the output will replace the buffer/selection. If replace is false, the output goes to a new buffer.

Source

pub fn execute_shell_command(&mut self, command: &str) -> Result<String, String>

Execute a shell command with the current buffer/selection as stdin. Returns Ok(output) on success, Err(error_message) on failure.

Source

pub fn handle_shell_command(&mut self, command: &str, replace: bool)

Handle shell command execution after prompt confirmation. If replace is true, replaces the selection/buffer with output. If replace is false, creates a new buffer with the output.

Source§

impl Editor

Source

pub fn split_pane_horizontal(&mut self)

Split the current pane horizontally

Source

pub fn split_pane_vertical(&mut self)

Split the current pane vertically

Source

pub fn close_active_split(&mut self)

Close the active split

Source

pub fn next_split(&mut self)

Switch to next split

Source

pub fn prev_split(&mut self)

Switch to previous split

Source

pub fn adjust_split_size(&mut self, delta: f32)

Adjust the size of the active split

Source

pub fn toggle_maximize_split(&mut self)

Toggle maximize state for the active split

Source

pub fn get_separator_areas( &self, ) -> &[(ContainerId, SplitDirection, u16, u16, u16)]

Get cached separator areas for testing Returns (split_id, direction, x, y, length) tuples

Source

pub fn get_tab_layouts(&self) -> &HashMap<LeafId, TabLayout>

Get cached tab layouts for testing

Source

pub fn get_split_areas(&self) -> &[(LeafId, BufferId, Rect, Rect, usize, usize)]

Get cached split content areas for testing Returns (split_id, buffer_id, content_rect, scrollbar_rect, thumb_start, thumb_end) tuples

Source

pub fn get_split_ratio(&self, split_id: SplitId) -> Option<f32>

Get the ratio of a specific split (for testing).

Looks in the main split tree first, then falls back to splits that live inside stashed Grouped subtrees (buffer-group panels).

Source

pub fn get_active_split(&self) -> LeafId

Get the active split ID (for testing)

Source

pub fn get_split_buffer(&self, split_id: SplitId) -> Option<BufferId>

Get the buffer ID for a split (for testing)

Source

pub fn get_split_tabs(&self, split_id: LeafId) -> Vec<BufferId>

Get the open buffers (tabs) in a split (for testing)

Source

pub fn get_split_count(&self) -> usize

Get the number of splits (for testing)

Source

pub fn compute_drop_zone( &self, col: u16, row: u16, source_split_id: LeafId, ) -> Option<TabDropZone>

Compute the drop zone for a tab drag at a given position (for testing)

Source§

impl Editor

Source

pub fn open_terminal(&mut self)

Open a new terminal in the active window’s current split, fire the editor-wide buffer_activated plugin hook, and post a status-bar message with the terminal-mode exit key.

Window-side body lives in Window::open_terminal_in_window; this router adds only the cross-cutting effects that require editor-level state (the plugin hook + status message).

Source

pub fn close_terminal(&mut self)

Close the current terminal (if viewing a terminal buffer)

Source

pub fn handle_terminal_key( &mut self, code: KeyCode, modifiers: KeyModifiers, ) -> bool

Handle terminal input when in terminal mode

Source

pub fn enter_terminal_mode(&mut self)

Re-enter terminal mode from read-only buffer view

This truncates the backing file to remove the visible screen tail that was appended when we exited terminal mode, leaving only the incrementally-streamed scrollback history.

Source

pub fn get_terminal_content( &self, buffer_id: BufferId, ) -> Option<Vec<Vec<TerminalCell>>>

Get terminal content for rendering

Source§

impl Editor

Source

pub fn is_terminal_mode(&self) -> bool

Check if terminal mode is active (for testing)

Source

pub fn is_in_terminal_mode_resume(&self, buffer_id: BufferId) -> bool

Check if a buffer is in terminal_mode_resume set (for testing/debugging)

Source

pub fn is_keyboard_capture(&self) -> bool

Check if keyboard capture is enabled in terminal mode (for testing)

Source

pub fn set_terminal_jump_to_end_on_output(&mut self, value: bool)

Set terminal jump_to_end_on_output config option (for testing)

Source

pub fn terminal_manager(&self) -> &TerminalManager

Get read-only access to the active window’s terminal manager (for testing). After Step 0d, terminal state lives on each window — this routes to the active one.

Source

pub fn terminal_backing_files(&self) -> &HashMap<TerminalId, PathBuf>

Get read-only access to the active window’s terminal backing files map (for testing).

Source

pub fn active_buffer_id(&self) -> BufferId

Get the currently active buffer ID

Source

pub fn get_buffer_content(&self, buffer_id: BufferId) -> Option<String>

Get buffer content as a string (for testing)

Source

pub fn get_cursor_position(&self, buffer_id: BufferId) -> Option<usize>

Get cursor position for a buffer (for testing)

Source§

impl Editor

Source

pub fn toggle_line_numbers(&mut self)

Toggle line numbers in the gutter for the active split.

Line number visibility is stored per-split in BufferViewState so that different splits of the same buffer can independently show/hide line numbers (e.g., source mode shows them, compose mode hides them).

Source

pub fn toggle_menu_bar(&mut self)

Toggle menu bar visibility.

editor.show_menu_bar is a global preference, so the toggle updates the runtime config and persists the change to the user config layer (same pattern as the file-explorer toggles). See issue #1156.

Source

pub fn toggle_file_explorer_side(&mut self)

Toggle the file explorer side between left and right.

Updates the runtime config and the active window’s runtime side shadow, then persists the change to the user config layer (same pattern as toggle_menu_bar).

Source

pub fn toggle_vertical_scrollbar(&mut self)

Toggle vertical scrollbar visibility

Source

pub fn toggle_horizontal_scrollbar(&mut self)

Toggle horizontal scrollbar visibility

Source

pub fn reset_buffer_settings(&mut self)

Reset buffer settings (tab_size, use_tabs, auto_close, whitespace visibility) to config defaults

Source

pub fn toggle_mouse_capture(&mut self)

Toggle mouse capture on/off

Source

pub fn is_mouse_enabled(&self) -> bool

Check if mouse capture is enabled

Source

pub fn toggle_mouse_hover(&mut self)

Toggle mouse hover for LSP on/off

On Windows, this also switches the mouse tracking mode: mode 1003 (all motion) when enabled, mode 1002 (cell motion) when disabled.

Source

pub fn is_mouse_hover_enabled(&self) -> bool

Check if mouse hover is enabled

Source

pub fn set_gpm_active(&mut self, active: bool)

Set GPM active flag (enables software mouse cursor rendering)

When GPM is used for mouse input on Linux consoles, we need to draw our own mouse cursor because GPM can’t draw on the alternate screen buffer used by TUI applications.

Source

pub fn toggle_inlay_hints(&mut self)

Toggle inlay hints visibility

Source

pub fn dump_config(&mut self)

Dump the current configuration to the user’s config file

Source

pub fn save_config(&self) -> Result<(), String>

Save the current configuration to file (without opening it)

Returns Ok(()) on success, or an error message on failure

Source

pub fn reload_config(&mut self)

Reload configuration from the config file

This reloads the config from disk, applies runtime changes (theme, keybindings), and emits a config_changed event so plugins can update their state accordingly. Uses the layered config system to properly merge with defaults.

Source

pub fn reload_themes(&mut self)

Reload the theme registry from disk.

Call this after installing new theme packages or saving new themes. This rescans all theme directories and updates the available themes list.

Source§

impl Editor

Source

pub fn handle_undo(&mut self)

Handle Undo action - revert the last edit operation.

Source

pub fn handle_redo(&mut self)

Handle Redo action - reapply an undone edit operation.

Source§

impl Editor

Source

pub fn open_stdin_buffer( &mut self, temp_path: &Path, thread_handle: Option<JoinHandle<Result<()>>>, ) -> AnyhowResult<BufferId>

The temp file path is preserved internally for lazy loading to work.

§Arguments
  • temp_path - Path to temp file where stdin content is being written
  • thread_handle - Optional handle to background thread streaming stdin to temp file
Source

pub fn poll_stdin_streaming(&mut self) -> bool

Poll stdin streaming state and extend buffer if file grew. Returns true if the status changed (needs render).

Source

pub fn complete_stdin_streaming(&mut self)

Mark stdin streaming as complete. Called when the background thread finishes.

Source

pub fn is_stdin_streaming(&self) -> bool

Check if stdin streaming is active (not complete).

Source

pub fn set_virtual_buffer_content( &mut self, buffer_id: BufferId, entries: Vec<TextPropertyEntry>, ) -> Result<(), String>

Create a new virtual buffer (not backed by a file)

§Arguments
  • name - Display name (e.g., “Diagnostics”)
  • mode - Buffer mode for keybindings (e.g., “diagnostics-list”)
  • read_only - Whether the buffer should be read-only
§Returns

The BufferId of the created virtual buffer

Like [Self::create_virtual_buffer] but does not add the new buffer to any split’s tab list. Use this 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 whatever the previously-active split was, requiring a separate cleanup pass to remove it. Set the content of a virtual buffer with text properties. Thin shim over [Window::set_virtual_buffer_content].

Source§

impl Editor

Source

pub fn create_window_at(&mut self, root: PathBuf, label: String) -> WindowId

Allocate a session id, insert a new Session, fire session_created. Does not switch active.

Caller is responsible for ensuring root is absolute. The PluginCommand::CreateWindow dispatcher rejects relative paths before reaching here.

Seeds the new window with an empty scratch buffer + a minimal split layout up front (same shape as the first-dive seed path), so the window is renderable immediately. Without this, never-dived windows have splits == None and any cross-window render (e.g. the Orchestrator preview pane’s WindowEmbed) draws blank.

Source

pub fn create_window_with_terminal( &mut self, root: PathBuf, label: String, cwd: Option<PathBuf>, command: Option<Vec<String>>, title: Option<String>, ) -> Result<(WindowId, TerminalId, BufferId), String>

Atomic “create a new window seeded with an agent terminal” entry point. Used by Orchestrator’s new-session flow.

Unlike create_window_at, this path deliberately does NOT seed an empty [No Name] buffer up front — the terminal becomes the window’s seed via create_plugin_terminal’s no-active-split branch, so the new window is born with a single tab (the terminal) instead of [No Name] | <agent>.

The eager-seed invariant create_window_at upholds (“window is renderable immediately after returning”) still holds here: the call to create_plugin_terminal runs synchronously on the same thread before this function yields, installing the terminal-rooted split layout before any other code can observe the window. The window_created hook is intentionally fired after the terminal is wired up so plugin handlers see the new window in its final shape, not the half-built intermediate state.

root must be absolute; the plugin-command dispatcher validates this before reaching here.

Source

pub fn set_active_window(&mut self, id: WindowId)

Switch the active window to id.

Pointer write: every per-window field (panel_ids / file_mod_times / file_explorer / lsp / splits) already lives on Window, so flipping active_window is the whole switch. Diving into a never-activated window seeds it with a fresh empty buffer + SplitManager so the renderer finds a populated splits field.

No-op when id is already active. Logs and returns when id is unknown — the design treats unknown ids as a plugin bug (caller verifies with listWindows), not a recoverable error worth surfacing through the channel.

Source

pub fn next_window(&mut self)

Cycle to the next open window in the workspace.

Windows are ordered by their numeric WindowId (which is monotonically assigned by create_window_at), so “next” reads in creation order with wrap-around. No-op when only one window is open (issue #2031).

Source

pub fn prev_window(&mut self)

Cycle to the previous open window. See Self::next_window for ordering.

Source

pub fn prewarm_window(&mut self, id: WindowId)

Eagerly initialise an inactive session’s per-session state without diving. Useful for plugins (Orchestrator) that want to pay the warm-up cost (file-tree walk, ignore matcher, etc.) ahead of the user’s first dive.

In the current build this is a placeholder — file explorer rebuilds and LSP boot still happen on first dive. The API exists so callers don’t have to be rewritten when eager warm-up wires up later.

Source

pub fn close_window(&mut self, id: WindowId) -> bool

Close a session and drop its Session entry. Refuses to close the currently active session — the caller must switch to a different session first. Refuses to close the base session (WindowId(1)) — that’s the editor’s anchor.

Returns true on success, false on rejection.

Source§

impl Editor

Source

pub fn capture_workspace(&self) -> Workspace

Capture the active window into a Workspace.

Delegates the per-window snapshot to Window::capture_workspace (rooted at the window’s own root) and injects the editor-global plugin_global_state, which the window cannot see.

Source

pub fn save_workspace(&mut self) -> Result<(), WorkspaceError>

Save the current (active) window’s workspace to disk. Thin active-window wrapper over Editor::save_workspace_for.

Source

pub fn try_restore_workspace(&mut self) -> Result<bool, WorkspaceError>

Try to load and apply a workspace for the active window. Thin active-window wrapper over Editor::restore_workspace_for.

Returns true if a workspace was successfully loaded and applied.

Source

pub fn apply_hot_exit_recovery(&mut self) -> Result<usize>

Apply hot exit recovery to all currently open file-backed buffers.

This restores unsaved changes from recovery files for buffers that were opened via CLI (without workspace restore). Returns the number of buffers recovered.

Source

pub fn save_workspace_for(&mut self, id: WindowId) -> Result<(), WorkspaceError>

Save a specific window’s workspace to disk, keyed by its own root. No active-window flip: reads windows[id] directly, snapshots via Window::capture_workspace, and injects the editor-global plugin_global_state.

Source

pub fn restore_workspace_for( &mut self, id: WindowId, ) -> Result<bool, WorkspaceError>

Restore a specific window’s workspace from disk into windows[id], keyed by its own root. No active-window flip: the entire window-local layout AND hot-exit recovery now run on windows[id] via Window::apply_workspace_layout (the recovery service is shared into the window via WindowResources). Only genuinely editor-global steps are layered on here:

  • restore_config_overrides (mutates the shared Config),
  • plugin_global_state assignment,
  • and, for the active window ONLY, the post-restore plugin snapshot + buffer_activated hook (background restores must not fire focus side-effects).
Source

pub fn save_all_windows_workspaces(&mut self) -> Result<(), WorkspaceError>

Save workspaces for every window whose split layout is populated. Each window’s workspace is keyed by its own root.

Returns the first error encountered, if any; logs and continues past per-window failures so a single bad window can’t block the other quits.

Source

pub fn restore_inactive_window_workspaces(&mut self)

Restore workspaces for every persisted window that isn’t the already-restored active one, each from its own root.

plugin_global_state is editor-wide and would otherwise be clobbered by the last window we touch, so we snapshot it once and restore it after the loop — the active window’s restore (run before this) is the one whose plugin state we keep.

Best-effort: per-window failures are logged but don’t stop the loop, so one corrupt workspace file can’t blank the others.

Source§

impl Editor

Source

pub fn active_state(&self) -> &EditorState

Get the currently active buffer state

Source

pub fn active_state_mut(&mut self) -> &mut EditorState

Get the currently active buffer state (mutable)

Source

pub fn active_cursors(&self) -> &Cursors

Get the cursors for the active buffer in the active split. Uses effective_active_split so focused buffer-group panels return their own cursors (not the outer split’s stale ones).

Source

pub fn active_cursors_mut(&mut self) -> &mut Cursors

Get the cursors for the active buffer in the active split (mutable)

Source

pub fn set_completion_items(&mut self, items: Vec<CompletionItem>)

Set completion items for type-to-filter (for testing)

Source

pub fn active_viewport(&self) -> &Viewport

Get the viewport for the active split

Source

pub fn active_viewport_mut(&mut self) -> &mut Viewport

Get the viewport for the active split (mutable)

Source

pub fn get_buffer_display_name(&self, buffer_id: BufferId) -> String

Get the display name for a buffer (filename or virtual buffer name)

Source

pub fn active_event_log(&self) -> &EventLog

Apply an event to the active buffer with all cross-cutting concerns. This is the centralized method that automatically handles:

  • Event application to buffer
  • Plugin hooks (after-insert, after-delete, etc.)
  • LSP notifications
  • Any other cross-cutting concerns

Get the event log for the active buffer

Source

pub fn active_event_log_mut(&mut self) -> &mut EventLog

Get the event log for the active buffer (mutable)

Source

pub fn register_status_bar_element( &self, plugin_name: &str, token_name: &str, title: &str, ) -> Result<(), String>

Register a status-bar token contributed by a plugin. Token key is “plugin_name:token_name”. Returns Err if token already registered or inputs are invalid.

Source

pub fn set_status_bar_value( &mut self, buffer_id: BufferId, key: &str, value: String, ) -> Result<(), String>

Set the value for a status-bar token on a specific buffer. Key format: “plugin_name:token_name”. The buffer is located across every window — buffers are uniquely owned, so at most one window matches.

Source

pub fn get_status_bar_elements(&self) -> Vec<(String, String)>

Get all registered status bar tokens for Settings UI. Returns Vec of (token_key_with_braces, title).

Source

pub fn get_status_bar_element_values( &self, buffer_id: BufferId, ) -> HashMap<String, String>

Snapshot of token values for a specific buffer (render path).

Source

pub fn current_status_bar_value( &self, buffer_id: BufferId, key: &str, ) -> Option<&str>

Current value of a single status-bar token for the given buffer, if any. Used by the plugin command dispatcher to detect no-op SetStatusBarValue commands (i.e. plugins re-publishing an unchanged value on every render).

Trait Implementations§

Source§

impl EditorTestApi for Editor

Source§

fn dispatch(&mut self, action: Action)

Apply a single semantic action, then drain async messages.
Source§

fn dispatch_seq(&mut self, actions: &[Action])

Apply a sequence of actions in order, draining async messages once at the end. Equivalent to calling dispatch per action but cheaper.
Source§

fn buffer_text(&self) -> String

Full buffer text. Panics if the buffer has unloaded regions (large-file mode); semantic theorems are not the right tool for large-file scenarios — write a layout/E2E test instead.
Source§

fn primary_caret(&self) -> Caret

Primary cursor projected to a Caret.
Source§

fn carets(&self) -> Vec<Caret>

All cursors projected to Carets, sorted by ascending position. The primary cursor is included. Use primary_caret() if you only care about the primary; use carets() for multi-cursor theorems.
Source§

fn selection_text(&mut self) -> String

Concatenated selected text across all cursors, in ascending position order, joined by \n. Returns the empty string if no cursor has a selection.
Source§

fn viewport_top_byte(&self) -> usize

Byte offset of the first line currently visible in the active viewport. After the renderer has run, this is the viewport’s scroll position. Without a render, this reflects the last reconciliation point.
Source§

fn terminal_width(&self) -> u16

Width of the active terminal in cells, as set at harness construction or via resize.
Source§

fn terminal_height(&self) -> u16

Height of the active terminal in cells.
Source§

fn gutter_width(&self) -> u16

Width of the line-number gutter in cells, computed from the active buffer’s line count. Includes the trailing separator if the renderer adds one.
Source§

fn hardware_cursor_position(&mut self) -> Option<(u16, u16)>

Screen cell of the primary cursor, in (col, row). None ⇒ the cursor is off-screen (scrolled past). Requires a prior render to be meaningful.
Source§

fn visible_byte_range(&self) -> Option<(usize, usize)>

(start_byte, end_byte) of the currently-visible buffer region. End is exclusive. None ⇒ unknown / not yet reconciled.
Source§

fn is_modified(&self) -> bool

true if the active buffer has unsaved changes since it was last loaded from / saved to disk. The “save point” is the commit in the undo/redo log at which the buffer’s on-disk representation matches its in-memory state. After loading a fresh file (no edits applied), this is false. After any edit it becomes true. Undoing back to the save point flips it back to false — the property under test in tests/semantic/undo_redo.rs::theorem_undo_to_save_point_*.
Source§

fn take_full_redraw_request_for_tests(&mut self) -> bool

Consume the one-shot “full hardware redraw” flag the editor’s event loop polls each frame: Action::RedrawScreen sets it, the loop’s tick clears it. Returns the previous value and resets the flag to false. Read more
Source§

fn modal_snapshot(&self) -> ModalSnapshot

Snapshot of the modal-popup stack visible to the user. Used by ModalScenario to assert on palette / picker / menu / completion state without screen scraping.
Source§

fn buffer_count(&self) -> usize

Number of buffers currently open across the workspace.
Source§

fn active_buffer_path(&self) -> Option<String>

Display path of the active buffer. None for unnamed buffers.
Source§

fn buffer_paths(&self) -> Vec<String>

Display paths of every open buffer in stable insertion order. Unnamed buffers appear as "<unnamed:NNN>".
Source§

fn dispatch_mouse_click(&mut self, col: u16, row: u16) -> bool

Dispatch a mouse click projected through the active viewport. (col, row) are absolute screen coordinates; gutter offset is applied internally. Returns true if the editor consumed the event.
Source§

fn seed_marker(&mut self, byte_offset: usize, symbol: &str, color: &str)

Seed a line indicator (margin marker) at byte_offset with the given symbol (used as both the indicator glyph and the namespace) and a color name ("red", "green", "blue", "yellow"; anything else falls back to Color::Red).
Source§

fn marker_positions(&self, symbol: &str) -> Vec<usize>

Current byte positions of every marker whose namespace matches symbol, in ascending order. Empty if no marker was seeded for that namespace.
Source§

fn active_event_log_len(&self) -> usize

Length (in events) of the active buffer’s event log. Used by PersistenceScenario save-point claims that check no undo history is dropped on a no-op file-watcher notification.
Source§

fn notify_file_changed(&mut self, path: &str)

Notify the editor that path on disk has changed. Triggers the auto-revert path; the editor reads the file and updates its buffer (or skips when on-disk content already matches).
Source§

fn create_side_by_side_diff( &mut self, name: &str, mode: &str, old_content: &str, new_content: &str, hunks: &[(usize, usize, usize, usize)], ) -> usize

Create a side-by-side composite diff view named name with mode mode. Builds two virtual buffers (OLD, NEW), seeds them with old_content / new_content, computes a line alignment from hunks, and switches the active buffer to the composite. Returns a 64-bit handle to the composite for follow-up calls (composite_next_hunk_on, set_composite_initial_focus_hunk_on).
Source§

fn set_composite_initial_focus_hunk_on( &mut self, composite_handle: usize, hunk_index: usize, )

Set the composite buffer’s initial_focus_hunk field — the one-shot “scroll to hunk N on first render” knob. The first render consumes the value and resets the field to None.
Source§

fn composite_initial_focus_hunk_on( &self, composite_handle: usize, ) -> Option<usize>

Read the composite buffer’s current initial_focus_hunk (after the first render this should be None, i.e. the field was consumed). Returns None for missing or non-composite buffers.
Source§

fn composite_next_hunk_active_on(&mut self, composite_handle: usize) -> bool

Jump the active split’s view of composite_handle to the next hunk. Mirrors the n / ] keybinding semantics; returns true iff a next hunk existed.
Source§

fn composite_prev_hunk_active_on(&mut self, composite_handle: usize) -> bool

Jump back to the previous hunk; companion of composite_next_hunk_active_on.
Source§

fn flush_layout_for_tests(&mut self)

Force-materialize composite view state across visible splits without performing a render. Lets a scenario reach hunk-nav state before any frame paints.
Source§

fn status_message(&self) -> Option<String>

Latest status message set by the editor (the same string the status bar would display). None ⇒ no message has been set since the last clear. Used by scrollbar-toggle scenarios that assert on the “Vertical scrollbar hidden/shown” round-trip.
Source§

fn seed_virtual_line( &mut self, byte_offset: usize, text: &str, fg: Option<(u8, u8, u8)>, bg: Option<(u8, u8, u8)>, placement: &str, namespace: &str, priority: i32, )

Inject a virtual line at the marker for byte_offset with text, fg/bg colors (each as Option<(r,g,b)>), placement ("above" or "below"), namespace, and priority.
Source§

fn virtual_text_count(&self) -> usize

Total count of virtual texts on the active state.
Source§

fn clear_virtual_text_namespace(&mut self, namespace: &str)

Clear every virtual text belonging to namespace.
Source§

fn add_margin_annotation( &mut self, line: usize, position: &str, symbol: &str, color: Option<(u8, u8, u8)>, annotation_id: Option<&str>, )

Inject a margin annotation (gutter symbol with optional color) at line (0-indexed). position is "left" or "right".
Source§

fn remove_margin_annotation(&mut self, annotation_id: &str)

Remove the previously-added margin annotation with this id.
Source§

fn margin_left_total_width(&self) -> usize

margins.left_total_width() of the active state, in cells.
Source§

fn top_line_number(&mut self) -> usize

1-indexed logical line number of the viewport’s top byte — the same observable the e2e scrollbar tests read via harness.top_line_number(). Used to assert a scroll position is (un)changed after a mouse interaction.
Source§

fn primary_scrollbar_geometry(&self) -> Option<(usize, usize, u16, u16)>

Cached scrollbar geometry of the primary (first) split: (thumb_start, thumb_end, scrollbar_height, scrollbar_y) — thumb extent in scrollbar-row offsets, the track’s height, and the track’s top terminal row. None ⇒ no split areas cached (no render yet). thumb_end > thumb_start indicates a non-degenerate thumb; thumb_end - thumb_start < scrollbar_height indicates the content is scrollable (the thumb does not fill the track) — the load-bearing claim of test_scrollbar_shows_scrollable_content_with_wrapped_lines. scrollbar_y lets a test resolve the thumb’s terminal row for a click/drag at the thumb midpoint.

Auto Trait Implementations§

§

impl !Freeze for Editor

§

impl !RefUnwindSafe for Editor

§

impl !Send for Editor

§

impl !Sync for Editor

§

impl Unpin for Editor

§

impl UnsafeUnpin for Editor

§

impl !UnwindSafe for Editor

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, T> FromIn<'a, T> for T

Source§

fn from_in(t: T, _: &'a Allocator) -> T

Converts to this type from the input type within the given allocator.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<'a, T, U> IntoIn<'a, U> for T
where U: FromIn<'a, T>,

Source§

fn into_in(self, allocator: &'a Allocator) -> U

Converts this type into the (usually inferred) input type within the given allocator.
Source§

impl<D> OwoColorize for D

Source§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
Source§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
Source§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
Source§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
Source§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
Source§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
Source§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
Source§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
Source§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
Source§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
Source§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
Source§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
Source§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
Source§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
Source§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
Source§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
Source§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
Source§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
Source§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
Source§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
Source§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
Source§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
Source§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
Source§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
Source§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
Source§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
Source§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
Source§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
Source§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
Source§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
Source§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
Source§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
Source§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
Source§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
Source§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
Source§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
Source§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
Source§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
Source§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
Source§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
Source§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
Source§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
Source§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
Source§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
Source§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
Source§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
Source§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
Source§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
Source§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
Source§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
Source§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
Source§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
Source§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
Source§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ParallelSend for T