Skip to main content

MultiTerminal

Struct MultiTerminal 

Source
pub struct MultiTerminal { /* private fields */ }
Expand description

Multi-pane terminal with per-pane broadcast toggles.

See the module-level documentation for the full interaction model.

Implementations§

Source§

impl MultiTerminal

Source

pub fn new(id_salt: impl Hash) -> Self

Create an empty widget. id_salt scopes the widget’s memory state; two MultiTerminals on the same page need distinct salts.

Source

pub fn with_pane(self, pane: TerminalPane) -> Self

Add a pane at construction time (builder form).

Source

pub fn columns(self, columns: usize) -> Self

Render with a fixed number of columns in the pane grid. Panes wrap after columns per row. Default: 2.

See also columns_auto for a width-responsive mode that’s better suited to large pane counts.

Source

pub fn columns_auto(self, min_col_width: f32) -> Self

Render with a width-responsive column count. Each frame the grid picks the largest column count such that every column is at least min_col_width points wide, clamped between 1 and the number of panes. With 16 panes, this naturally produces 3–4 columns on a wide monitor and 1–2 on a narrow sidebar.

min_col_width is clamped to a minimum of 240 pt so the pane header always has room for the chevron, hostname, solo button, broadcast pill and status indicator.

Source

pub fn pane_min_height(self, h: f32) -> Self

Minimum height of a single pane, in points. Default: 220.0.

Source

pub fn scrollback_cap(self, n: usize) -> Self

Cap on the number of lines retained per pane. Older lines are dropped when the buffer exceeds this count. Default: 500.

Source

pub fn add_pane(&mut self, pane: TerminalPane)

Append a pane at runtime.

Source

pub fn remove_pane(&mut self, id: &str)

Remove a pane by id.

Source

pub fn pane(&self, id: &str) -> Option<&TerminalPane>

Borrow a pane by id.

Source

pub fn pane_mut(&mut self, id: &str) -> Option<&mut TerminalPane>

Borrow a pane mutably by id.

Source

pub fn panes(&self) -> &[TerminalPane]

All panes, in grid order.

Source

pub fn push_line(&mut self, id: &str, line: TerminalLine)

Append a line to the pane with the given id. No-op if not found. Applies the scrollback cap.

Source

pub fn set_status(&mut self, id: &str, status: TerminalStatus)

Change a pane’s status at runtime. If the pane leaves the connected state, it’s removed from the broadcast set.

Source

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

Id of the currently focused pane, if any.

Source

pub fn set_focused(&mut self, id: Option<String>)

Programmatically set the focused pane.

Source

pub fn broadcast(&self) -> &HashSet<String>

Current broadcast set (pane ids that will receive input). Does not include offline panes.

Source

pub fn set_broadcast(&mut self, set: HashSet<String>)

Replace the broadcast set wholesale. Invalidates the stash used by the Solo / All-on toggles.

Source

pub fn is_collapsed(&self, id: &str) -> bool

Whether a pane is currently collapsed (rendered as a header-only strip with its scrollback hidden).

Source

pub fn set_collapsed(&mut self, id: &str, collapsed: bool)

Collapse or expand a pane by id.

Source

pub fn toggle_collapsed(&mut self, id: &str)

Flip the collapsed state of a pane.

Source

pub fn collapse_all(&mut self)

Collapse every pane to its header strip.

Source

pub fn expand_all(&mut self)

Expand every pane back to full height.

Source

pub fn toggle_broadcast(&mut self, id: &str)

Toggle whether id is in the broadcast set. Connected panes only.

Source

pub fn solo(&mut self, id: &str)

Collapse the broadcast set to just the pane with the given id, and focus that pane. Calling solo on a pane that’s already the sole receiver restores the previously-stashed set (so the button toggles).

No-op if the id doesn’t match a connected pane.

Source

pub fn solo_focused(&mut self)

Solo the currently-focused pane. See solo for the toggle semantics. Bound to the Cmd/Ctrl+D shortcut.

Source

pub fn broadcast_all(&mut self)

Toggle broadcast on every connected pane. If every connected pane is already in the broadcast set, clears it; otherwise fills it with every connected pane.

Note: when the set ends up empty, the focused pane still receives input as a fallback so the buffer always has somewhere to go.

Source

pub fn invert_broadcast(&mut self)

Flip the broadcast state on every connected pane (off becomes on and vice versa). Clears the stash.

Source

pub fn pending(&self) -> &str

Current pending input (what the user is typing).

Source

pub fn clear_pending(&mut self)

Clear the pending input buffer.

Source

pub fn take_events(&mut self) -> Vec<TerminalEvent>

Drain and return the events accumulated since the previous call. Call this once per frame after show to react to user-submitted commands.

Source

pub fn show(&mut self, ui: &mut Ui) -> Response

Render the widget. Call once per frame inside a CentralPanel or similar container.

Trait Implementations§

Source§

impl Debug for MultiTerminal

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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.