pub struct PaneManager { /* private fields */ }Expand description
Manages the pane tree within a single tab
Implementations§
Source§impl PaneManager
impl PaneManager
Sourcepub fn create_initial_pane(
&mut self,
config: &Config,
runtime: Arc<Runtime>,
working_directory: Option<String>,
) -> Result<PaneId>
pub fn create_initial_pane( &mut self, config: &Config, runtime: Arc<Runtime>, working_directory: Option<String>, ) -> Result<PaneId>
Create the initial pane (when tab is first created)
If bounds have been set on the PaneManager via set_bounds(), the pane
will be created with dimensions calculated from those bounds. Otherwise,
the default config dimensions are used.
Sourcepub fn create_initial_pane_for_split(
&mut self,
direction: SplitDirection,
config: &Config,
runtime: Arc<Runtime>,
working_directory: Option<String>,
) -> Result<PaneId>
pub fn create_initial_pane_for_split( &mut self, direction: SplitDirection, config: &Config, runtime: Arc<Runtime>, working_directory: Option<String>, ) -> Result<PaneId>
Create the initial pane sized for an upcoming split
This calculates dimensions based on what the pane size will be AFTER the split, preventing the shell from seeing a resize.
Sourcepub fn split(
&mut self,
direction: SplitDirection,
focus_new: bool,
config: &Config,
runtime: Arc<Runtime>,
initial_command: Option<(String, Vec<String>)>,
ratio: f32,
) -> Result<Option<PaneId>>
pub fn split( &mut self, direction: SplitDirection, focus_new: bool, config: &Config, runtime: Arc<Runtime>, initial_command: Option<(String, Vec<String>)>, ratio: f32, ) -> Result<Option<PaneId>>
Split the focused pane in the given direction
Returns the ID of the new pane, or None if no pane is focused.
initial_command — when Some((cmd, args)) the new pane launches that
process directly instead of the login shell. The pane closes when the
process exits.
Source§impl PaneManager
impl PaneManager
Sourcepub fn close_pane(&mut self, id: PaneId) -> bool
pub fn close_pane(&mut self, id: PaneId) -> bool
Close a pane by ID
Returns true if this was the last pane (tab should close)
Navigate to a pane in the given direction
Sourcepub fn focus_pane(&mut self, id: PaneId)
pub fn focus_pane(&mut self, id: PaneId)
Focus a specific pane by ID
Sourcepub fn focus_pane_at(&mut self, x: f32, y: f32) -> Option<PaneId>
pub fn focus_pane_at(&mut self, x: f32, y: f32) -> Option<PaneId>
Focus the pane at a given pixel position
Sourcepub fn focused_pane(&self) -> Option<&Pane>
pub fn focused_pane(&self) -> Option<&Pane>
Get the currently focused pane
Sourcepub fn focused_pane_mut(&mut self) -> Option<&mut Pane>
pub fn focused_pane_mut(&mut self) -> Option<&mut Pane>
Get the currently focused pane mutably
Sourcepub fn focused_pane_id(&self) -> Option<PaneId>
pub fn focused_pane_id(&self) -> Option<PaneId>
Get the focused pane ID
Source§impl PaneManager
impl PaneManager
Sourcepub fn set_bounds(&mut self, bounds: PaneBounds)
pub fn set_bounds(&mut self, bounds: PaneBounds)
Set the total bounds available for panes and recalculate layout
Sourcepub fn recalculate_bounds(&mut self)
pub fn recalculate_bounds(&mut self)
Recalculate bounds for all panes
Sourcepub fn resize_all_terminals(&self, cell_width: f32, cell_height: f32)
pub fn resize_all_terminals(&self, cell_width: f32, cell_height: f32)
Resize all pane terminals to match their current bounds
This should be called after bounds are updated (split, resize, window resize) to ensure each PTY is sized correctly for its pane area.
Sourcepub fn resize_all_terminals_with_padding(
&self,
cell_width: f32,
cell_height: f32,
padding: f32,
height_offset: f32,
)
pub fn resize_all_terminals_with_padding( &self, cell_width: f32, cell_height: f32, padding: f32, height_offset: f32, )
Resize all terminal PTYs to match their pane bounds, accounting for padding.
The padding reduces the content area where text is rendered, so terminals should be sized for the padded (smaller) area to avoid content being cut off.
height_offset is an additional height reduction (e.g., pane title bar height)
subtracted once from each pane’s content height.
Sourcepub fn set_divider_width(&mut self, width: f32)
pub fn set_divider_width(&mut self, width: f32)
Set the divider width
Sourcepub fn divider_width(&self) -> f32
pub fn divider_width(&self) -> f32
Get the divider width
Sourcepub fn divider_hit_padding(&self) -> f32
pub fn divider_hit_padding(&self) -> f32
Get the hit detection padding (extra area around divider for easier grabbing)
Sourcepub fn resize_split(&mut self, pane_id: PaneId, delta: f32)
pub fn resize_split(&mut self, pane_id: PaneId, delta: f32)
Resize a split by adjusting its ratio
pane_id: The pane whose adjacent split should be resized
delta: Amount to adjust the ratio (-1.0 to 1.0)
Sourcepub fn get_dividers(&self) -> Vec<DividerRect>
pub fn get_dividers(&self) -> Vec<DividerRect>
Get all divider rectangles in the pane tree
Sourcepub fn find_divider_at(&self, x: f32, y: f32, padding: f32) -> Option<usize>
pub fn find_divider_at(&self, x: f32, y: f32, padding: f32) -> Option<usize>
Find a divider at the given position
Returns the index of the divider if found, with optional padding for easier grabbing
Sourcepub fn is_on_divider(&self, x: f32, y: f32) -> bool
pub fn is_on_divider(&self, x: f32, y: f32) -> bool
Check if a position is on a divider
Sourcepub fn set_divider_hit_width(&mut self, width: f32)
pub fn set_divider_hit_width(&mut self, width: f32)
Set the divider hit width
Sourcepub fn get_divider(&self, index: usize) -> Option<DividerRect>
pub fn get_divider(&self, index: usize) -> Option<DividerRect>
Get the divider at an index
Sourcepub fn drag_divider(&mut self, divider_index: usize, new_x: f32, new_y: f32)
pub fn drag_divider(&mut self, divider_index: usize, new_x: f32, new_y: f32)
Resize by dragging a divider to a new position
divider_index: Which divider is being dragged
new_position: New mouse position (x for vertical, y for horizontal dividers)
Source§impl PaneManager
impl PaneManager
Sourcepub fn build_from_layout(
&mut self,
layout: &SessionPaneNode,
config: &Config,
runtime: Arc<Runtime>,
) -> Result<()>
pub fn build_from_layout( &mut self, layout: &SessionPaneNode, config: &Config, runtime: Arc<Runtime>, ) -> Result<()>
Build a pane tree from a saved session layout
Recursively constructs live PaneNode tree from a SessionPaneNode,
creating new terminal panes for each leaf. If a leaf’s CWD no longer
exists, falls back to $HOME.
Source§impl PaneManager
impl PaneManager
Sourcepub fn set_from_tmux_layout(
&mut self,
layout: &TmuxLayout,
config: &Config,
runtime: Arc<Runtime>,
) -> Result<HashMap<TmuxPaneId, PaneId>>
pub fn set_from_tmux_layout( &mut self, layout: &TmuxLayout, config: &Config, runtime: Arc<Runtime>, ) -> Result<HashMap<TmuxPaneId, PaneId>>
Set the pane tree from a tmux layout
This replaces the entire pane tree with one constructed from the tmux layout. Returns a mapping of tmux pane IDs to native pane IDs.
§Arguments
layout- The parsed tmux layoutconfig- Configuration for creating panesruntime- Async runtime for pane tasks
Sourcepub fn rebuild_from_tmux_layout(
&mut self,
layout: &TmuxLayout,
existing_mappings: &HashMap<TmuxPaneId, PaneId>,
new_tmux_panes: &[TmuxPaneId],
config: &Config,
runtime: Arc<Runtime>,
) -> Result<HashMap<TmuxPaneId, PaneId>>
pub fn rebuild_from_tmux_layout( &mut self, layout: &TmuxLayout, existing_mappings: &HashMap<TmuxPaneId, PaneId>, new_tmux_panes: &[TmuxPaneId], config: &Config, runtime: Arc<Runtime>, ) -> Result<HashMap<TmuxPaneId, PaneId>>
Rebuild the pane tree from a tmux layout, preserving existing pane terminals
This is called when panes are added or the layout structure changes. It rebuilds the entire tree structure to match the tmux layout while reusing existing Pane objects to preserve their terminal state.
§Arguments
layout- The parsed tmux layoutexisting_mappings- Map from tmux pane ID to native pane ID for panes to preservenew_tmux_panes- List of new tmux pane IDs that need new Pane objectsconfig- Configuration for creating new panesruntime- Async runtime for new pane tasks
§Returns
Updated mapping of tmux pane IDs to native pane IDs
Source§impl PaneManager
impl PaneManager
Sourcepub fn update_layout_from_tmux(
&mut self,
layout: &TmuxLayout,
pane_mappings: &HashMap<TmuxPaneId, PaneId>,
)
pub fn update_layout_from_tmux( &mut self, layout: &TmuxLayout, pane_mappings: &HashMap<TmuxPaneId, PaneId>, )
Update the layout structure (ratios) from a tmux layout without recreating terminals
This is called when the tmux pane IDs haven’t changed but the layout dimensions have (e.g., due to resize or another client connecting). It updates the split ratios in our pane tree to match the tmux layout.
Sourcepub fn update_from_tmux_layout(
&mut self,
layout: &TmuxLayout,
existing_mappings: &HashMap<TmuxPaneId, PaneId>,
config: &Config,
runtime: Arc<Runtime>,
) -> Result<Option<HashMap<TmuxPaneId, PaneId>>>
pub fn update_from_tmux_layout( &mut self, layout: &TmuxLayout, existing_mappings: &HashMap<TmuxPaneId, PaneId>, config: &Config, runtime: Arc<Runtime>, ) -> Result<Option<HashMap<TmuxPaneId, PaneId>>>
Update an existing pane tree to match a new tmux layout
This tries to preserve existing panes where possible and only creates/destroys panes as needed.
Returns updated mappings (Some = new mappings, None = no changes needed)
Source§impl PaneManager
impl PaneManager
Sourcepub fn new_with_existing_terminal(
terminal: Arc<RwLock<TerminalManager>>,
working_directory: Option<String>,
is_active: Arc<AtomicBool>,
) -> Self
pub fn new_with_existing_terminal( terminal: Arc<RwLock<TerminalManager>>, working_directory: Option<String>, is_active: Arc<AtomicBool>, ) -> Self
Create a pane manager pre-populated with a single primary pane that
wraps an already-running TerminalManager.
This is used by Tab::new_internal so that every tab always starts with
a PaneManager (R-32). The primary pane shares the caller’s terminal
Arc, so no new shell process is spawned.
§Arguments
terminal—Arccloned fromTab::terminalworking_directory— Optional CWD for the primary paneis_active— Shared atomic cloned fromTab::is_active
Sourcepub fn new_with_pane(pane: Pane) -> Self
pub fn new_with_pane(pane: Pane) -> Self
Create a pane manager wrapping an existing Pane as the single root node.
Used by Tab::new_from_pane() when promoting a pane to its own tab.
The pane’s ID is preserved and next_pane_id is advanced past it.
Sourcepub fn with_initial_pane(
config: &Config,
runtime: Arc<Runtime>,
working_directory: Option<String>,
) -> Result<Self>
pub fn with_initial_pane( config: &Config, runtime: Arc<Runtime>, working_directory: Option<String>, ) -> Result<Self>
Create a pane manager with an initial pane
Sourcepub fn next_pane_id(&self) -> PaneId
pub fn next_pane_id(&self) -> PaneId
Get the next pane ID that will be assigned
Sourcepub fn get_pane_mut(&mut self, id: PaneId) -> Option<&mut Pane>
pub fn get_pane_mut(&mut self, id: PaneId) -> Option<&mut Pane>
Get a mutable pane by ID
Sourcepub fn all_panes_mut(&mut self) -> Vec<&mut Pane>
pub fn all_panes_mut(&mut self) -> Vec<&mut Pane>
Get all panes mutably
Sourcepub fn collect_pane_backgrounds(&self) -> Vec<PaneBackgroundConfig>
pub fn collect_pane_backgrounds(&self) -> Vec<PaneBackgroundConfig>
Collect current per-pane background settings for config persistence
Returns a Vec<PaneBackgroundConfig> containing only panes that have
a custom background image set. The index field corresponds to the
pane’s position in the tree traversal order.
Sourcepub fn pane_count(&self) -> usize
pub fn pane_count(&self) -> usize
Get the number of panes
Sourcepub fn has_multiple_panes(&self) -> bool
pub fn has_multiple_panes(&self) -> bool
Check if there are multiple panes
Sourcepub fn insert_subtree_at(
&mut self,
target_pane_id: PaneId,
subtree: PaneNode,
direction: SplitDirection,
ratio: f32,
) -> Result<PaneIdRemap, PaneNode>
pub fn insert_subtree_at( &mut self, target_pane_id: PaneId, subtree: PaneNode, direction: SplitDirection, ratio: f32, ) -> Result<PaneIdRemap, PaneNode>
Insert a PaneNode subtree into the tree by splitting the target pane.
The target leaf is replaced with a Split containing the original pane
as one child and the subtree as the other. Bounds are recalculated.
On success, returns the ids the adopted panes hold afterwards, which are not always the ids they arrived with.
On failure — there is no tree here to insert into, or no pane holds
target_pane_id — the tree is left untouched and the subtree is handed
back, carrying the ids it arrived with. Handing it back is the point
of the Err, not a courtesy: a caller gets a subtree to pass here by
detaching it from wherever it was living, so this is the only remaining
reference to those panes, and dropping it closes them and kills their
PTYs. The caller must put it back somewhere.
A subtree arriving from another tab (“Demote Tab to Pane”) brings that
tab’s ids with it, and ids are allocated per PaneManager — that is,
per tab — so an incoming id can already belong to a pane here: tab A’s
panes 1 and 2 landing in a tab that already holds 1 and 2. get_pane is
a search over the tree, so a duplicate would make every id-keyed lookup
resolve to whichever pane the walk reaches first, and the adopted pane
would be unreachable. Colliding panes are therefore renumbered from this
manager’s counter.
Advancing the counter past every adopted id closes the other half: this tab must not later hand a new pane an id one of the adopted panes is already using.
A caller holding an id from the subtree across this call must translate it through the returned map; the pre-move id may now name a different pane, or no pane at all.
Sourcepub fn extract_pane(&mut self, target_id: PaneId) -> ExtractResult
pub fn extract_pane(&mut self, target_id: PaneId) -> ExtractResult
Extract a pane from the tree by ID, returning ownership of the live Pane.
Unlike remove_pane() which drops the pane, this returns the pane
intact so it can be transferred to another tab or pane tree.
All processes in the pane’s PTY continue running.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for PaneManager
impl !UnwindSafe for PaneManager
impl Freeze for PaneManager
impl Send for PaneManager
impl Sync for PaneManager
impl Unpin for PaneManager
impl UnsafeUnpin for PaneManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().