libtmux Reference MCP Search
On this page

pane.Pane.join_into

View as Markdown

Module
pane
Declared in
Pane
Package
libtmux
Source
crates/libtmux/src/pane.rs
join_into ( self , beside : &Self , options : crate::JoinOptions ) Result<Self, Error>
method [source]
method [source]
join_into

Move this pane into another window, beside a pane already there.

The inverse of Pane::break_out , and it consumes the handle for the same reason: the pane's window changes, so a snapshot of where it used to be is wrong. The pane keeps its id and everything running in it, so the handle returned is this same pane read again where it now lives.

Errors

Returns Error::ServerMismatch when beside belongs to another server, or an error when tmux refuses the move, including a pane joined to its own window.

Examples

use libtmux::{JoinOptions, SplitDirection};

let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("moving").await?;
let window = session.active_window().await?.expect("a window");
let elsewhere = session.new_window("elsewhere").await?;

let stranded = elsewhere.panes().await?.remove(0);
let here = window.panes().await?.remove(0);
let moved = stranded
    .join_into(&here, JoinOptions::new(SplitDirection::Below))
    .await?;

assert_eq!(moved.window_id(), window.id());

guard.shutdown().await?;

0 declared, 0 inherited

Esc

Type to search.