# pane.Pane.resize_by

- **Module:** pane.Pane
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/libtmux/src/pane.rs#L472
- **Page:** https://libtmux.org/reference/rs/pane-pane-resize_by/

```
pane.Pane.resize_by(mut, direction: crate::ResizeDirection, cells: u32) -> Result<&mut Self, Error>
```

Move one edge of the pane by a number of cells.

This is the form a keybinding uses: "two rows taller" rather than a
size computed from the current one. A pane that is alone in its window
has no edge to move, and tmux accepts the request without doing
anything.

# Errors

Returns an error when tmux refuses the resize.

## Example

```rust
use libtmux::{ResizeDirection, SplitDirection, SplitOptions};

let session = server.new_session("resized-pane").await?;
let pane = session.panes().await?.remove(0);
pane.split(SplitOptions::new(SplitDirection::Below).command("sleep 300")).await?;

let mut pane = pane.refreshed().await?;
let before = pane.height();
pane.resize_by(ResizeDirection::Down, 2).await?;

assert_eq!(pane.height(), before + 2);
```
