pub struct PaneManager { /* private fields */ }Expand description
Manages the pane tree within a single tab
Implementations§
Source§impl PaneManager
impl PaneManager
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 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,
config: &Config,
runtime: Arc<Runtime>,
) -> Result<Option<PaneId>>
pub fn split( &mut self, direction: SplitDirection, config: &Config, runtime: Arc<Runtime>, ) -> 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
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
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 add_pane_for_tmux(&mut self, pane: Pane)
pub fn add_pane_for_tmux(&mut self, pane: Pane)
Add a pane for tmux integration (doesn’t create split, just adds to flat structure)
This is used when tmux splits a pane - we need to add a new native pane without restructuring our tree (tmux layout update will handle that).
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 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)
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.
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
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)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PaneManager
impl !RefUnwindSafe for PaneManager
impl Send for PaneManager
impl Sync for PaneManager
impl Unpin for PaneManager
impl UnsafeUnpin for PaneManager
impl !UnwindSafe 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
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
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
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().