Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

pane.Pane.is_at_top

Rust

View as Markdown

Module
pane
Declared in
Pane
Package
libtmux
Source
crates/libtmux/src/pane.rs
Other languages
Python TypeScript Go Java .NETC++Swift
is_at_top ( self ) → bool
method [source]
method [source]
is_at_top

Report whether the pane touches the top edge of its window.

The four edge predicates are what tell a caller a directional move has nowhere to go: a pane at the top has no neighbour above it, so selecting one would wrap or fail rather than move.

Examples

use libtmux::{SplitDirection, SplitOptions};
let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("edges").await?;
let mut window = session.active_window().await?.expect("a window");
// One pane fills the window, so it touches every edge.
let only = window.active_pane().await?.expect("a pane");
assert!(only.is_at_top() && only.is_at_bottom());
// Splitting below leaves the original touching the top and not the
// bottom, and the new one the other way round.
let lower = window.split(SplitOptions::new(SplitDirection::Below)).await?;
let upper = window
.panes()
.await?
.into_iter()
.find(|pane| pane.id() != lower.id())
.expect("the original pane");
assert!(upper.is_at_top() && !upper.is_at_bottom());
assert!(lower.is_at_bottom() && !lower.is_at_top());
guard.shutdown().await?;
In other ports Whether a pane touches the top of its window

0 declared, 0 inherited

Esc

Type to search.