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
impl MultiTerminal
Sourcepub fn new(id_salt: impl Hash) -> Self
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.
Sourcepub fn with_pane(self, pane: TerminalPane) -> Self
pub fn with_pane(self, pane: TerminalPane) -> Self
Add a pane at construction time (builder form).
Sourcepub fn columns(self, columns: usize) -> Self
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.
Sourcepub fn columns_auto(self, min_col_width: f32) -> Self
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.
Sourcepub fn pane_min_height(self, h: f32) -> Self
pub fn pane_min_height(self, h: f32) -> Self
Minimum height of a single pane, in points. Default: 220.0.
Sourcepub fn scrollback_cap(self, n: usize) -> Self
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.
Sourcepub fn history_cap(self, n: usize) -> Self
pub fn history_cap(self, n: usize) -> Self
Cap on the shared command history (Up / Down navigation). Older entries are dropped when the buffer exceeds this count. Default: 200.
Sourcepub fn auto_focus(self, enabled: bool) -> Self
pub fn auto_focus(self, enabled: bool) -> Self
Whether the widget should auto-claim keyboard focus when no other
widget owns it. Default: true. Disable in apps where global Tab /
Esc navigation would otherwise be swallowed.
Sourcepub fn add_pane(&mut self, pane: TerminalPane)
pub fn add_pane(&mut self, pane: TerminalPane)
Append a pane at runtime.
Sourcepub fn remove_pane(&mut self, id: &str)
pub fn remove_pane(&mut self, id: &str)
Remove a pane by id.
Sourcepub fn pane(&self, id: &str) -> Option<&TerminalPane>
pub fn pane(&self, id: &str) -> Option<&TerminalPane>
Borrow a pane by id.
Sourcepub fn pane_mut(&mut self, id: &str) -> Option<&mut TerminalPane>
pub fn pane_mut(&mut self, id: &str) -> Option<&mut TerminalPane>
Borrow a pane mutably by id.
Sourcepub fn panes(&self) -> &[TerminalPane]
pub fn panes(&self) -> &[TerminalPane]
All panes, in grid order.
Sourcepub fn push_line(&mut self, id: &str, line: TerminalLine)
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.
Sourcepub fn set_status(&mut self, id: &str, status: TerminalStatus)
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.
Sourcepub fn set_focused(&mut self, id: Option<String>)
pub fn set_focused(&mut self, id: Option<String>)
Programmatically set the focused pane.
Sourcepub fn broadcast(&self) -> &HashSet<String>
pub fn broadcast(&self) -> &HashSet<String>
Current broadcast set (pane ids that will receive input). Does not include offline panes.
Sourcepub fn set_broadcast(&mut self, set: HashSet<String>)
pub fn set_broadcast(&mut self, set: HashSet<String>)
Replace the broadcast set wholesale. Invalidates the stash used by the Solo / All-on toggles.
Sourcepub fn is_collapsed(&self, id: &str) -> bool
pub fn is_collapsed(&self, id: &str) -> bool
Whether a pane is currently collapsed (rendered as a header-only strip with its scrollback hidden).
Sourcepub fn set_collapsed(&mut self, id: &str, collapsed: bool)
pub fn set_collapsed(&mut self, id: &str, collapsed: bool)
Collapse or expand a pane by id.
Sourcepub fn toggle_collapsed(&mut self, id: &str)
pub fn toggle_collapsed(&mut self, id: &str)
Flip the collapsed state of a pane.
Sourcepub fn collapse_all(&mut self)
pub fn collapse_all(&mut self)
Collapse every pane to its header strip.
Sourcepub fn expand_all(&mut self)
pub fn expand_all(&mut self)
Expand every pane back to full height.
Sourcepub fn toggle_broadcast(&mut self, id: &str)
pub fn toggle_broadcast(&mut self, id: &str)
Toggle whether id is in the broadcast set. Connected panes only.
Sourcepub fn solo(&mut self, id: &str)
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.
Sourcepub fn solo_focused(&mut self)
pub fn solo_focused(&mut self)
Solo the currently-focused pane. See solo for the
toggle semantics. Bound to the Cmd/Ctrl+D shortcut.
Sourcepub fn broadcast_all(&mut self)
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. When the set ends up empty, Enter is a no-op until the user opts panes back in.
Sourcepub fn invert_broadcast(&mut self)
pub fn invert_broadcast(&mut self)
Flip the broadcast state on every connected pane (off becomes on and vice versa). Clears the stash.
Sourcepub fn clear_pending(&mut self)
pub fn clear_pending(&mut self)
Clear the pending input buffer (and reset the editing cursor).
Sourcepub fn take_events(&mut self) -> Vec<TerminalEvent>
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.
Sourcepub fn show(&mut self, ui: &mut Ui) -> Response
pub fn show(&mut self, ui: &mut Ui) -> Response
Render the widget. Call once per frame inside a CentralPanel or
similar container.
Sourcepub fn send_command(&mut self, cmd: &str) -> bool
pub fn send_command(&mut self, cmd: &str) -> bool
Run cmd against the current broadcast targets exactly as if the
user had typed it and pressed Enter: trims the command, echoes it
into each target pane, appends to the shared history (deduped
against the previous entry), and emits a TerminalEvent::Command.
The pending input buffer is left untouched.
Returns true if the command was dispatched, false if it was
empty after trimming or no panes are reachable.