Skip to main content

PaneManager

Struct PaneManager 

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

Manages the pane tree within a single tab

Implementations§

Source§

impl PaneManager

Source

pub fn new() -> Self

Create a new empty pane manager

Source

pub fn with_initial_pane( config: &Config, runtime: Arc<Runtime>, working_directory: Option<String>, ) -> Result<Self>

Create a pane manager with an initial pane

Source

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.

Source

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.

Source

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

Source

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)

Source

pub fn navigate(&mut self, direction: NavigationDirection)

Navigate to a pane in the given direction

Source

pub fn focus_pane(&mut self, id: PaneId)

Focus a specific pane by ID

Source

pub fn focus_pane_at(&mut self, x: f32, y: f32) -> Option<PaneId>

Focus the pane at a given pixel position

Source

pub fn focused_pane(&self) -> Option<&Pane>

Get the currently focused pane

Source

pub fn focused_pane_mut(&mut self) -> Option<&mut Pane>

Get the currently focused pane mutably

Source

pub fn focused_pane_id(&self) -> Option<PaneId>

Get the focused pane ID

Source

pub fn next_pane_id(&self) -> PaneId

Get the next pane ID that will be assigned

Source

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

Source

pub fn get_pane(&self, id: PaneId) -> Option<&Pane>

Get a pane by ID

Source

pub fn get_pane_mut(&mut self, id: PaneId) -> Option<&mut Pane>

Get a mutable pane by ID

Source

pub fn all_panes(&self) -> Vec<&Pane>

Get all panes

Source

pub fn all_panes_mut(&mut self) -> Vec<&mut Pane>

Get all panes mutably

Source

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.

Source

pub fn pane_count(&self) -> usize

Get the number of panes

Source

pub fn has_multiple_panes(&self) -> bool

Check if there are multiple panes

Source

pub fn set_bounds(&mut self, bounds: PaneBounds)

Set the total bounds available for panes and recalculate layout

Source

pub fn recalculate_bounds(&mut self)

Recalculate bounds for all panes

Source

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.

Source

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.

Source

pub fn set_divider_width(&mut self, width: f32)

Set the divider width

Source

pub fn divider_width(&self) -> f32

Get the divider width

Source

pub fn divider_hit_padding(&self) -> f32

Get the hit detection padding (extra area around divider for easier grabbing)

Source

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)

Source

pub fn root(&self) -> Option<&PaneNode>

Get access to the root node (for rendering)

Source

pub fn root_mut(&mut self) -> Option<&mut PaneNode>

Get mutable access to the root node

Source

pub fn get_dividers(&self) -> Vec<DividerRect>

Get all divider rectangles in the pane tree

Source

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

Source

pub fn is_on_divider(&self, x: f32, y: f32) -> bool

Check if a position is on a divider

Source

pub fn set_divider_hit_width(&mut self, width: f32)

Set the divider hit width

Source

pub fn get_divider(&self, index: usize) -> Option<DividerRect>

Get the divider at an index

Source

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

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

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 layout
  • config - Configuration for creating panes
  • runtime - Async runtime for pane tasks
Source

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 layout
  • existing_mappings - Map from tmux pane ID to native pane ID for panes to preserve
  • new_tmux_panes - List of new tmux pane IDs that need new Pane objects
  • config - Configuration for creating new panes
  • runtime - Async runtime for new pane tasks
§Returns

Updated mapping of tmux pane IDs to native pane IDs

Source

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.

Source

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§

Source§

impl Default for PaneManager

Source§

fn default() -> Self

Returns the “default value” for a type. 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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
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<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

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

Source§

fn upcast(&self) -> Option<&T>

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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,