How Folding Rearranges Your Panes
Folding follows a few simple rules. This page states them, so you can predict what a fold does to your layout.
Folding is an overlay on your layout
Nash keeps your normal layout: the sizes your panes have when nothing is folded. A fold does not change it. Nash draws the strips on top of the layout and gives their space to the neighbors.
This has two consequences:
- Unfolding a pane puts it back in exactly the place and size it had. This holds in any order. You can fold three panes and unfold them in any sequence.
- Everything that resizes panes, such as a window resize, a divider drag, a split, or a close, works on the normal layout, as it did before you folded anything.
Which neighbor takes the space
A pane belongs to a column of stacked panes or a row of side-by-side panes. A fold hands the space to the unfolded panes directly beside it in that column or row. Where the strip sits, and who grows, follows from the pane's position.
In a column, the panes in the upper half fold up: the strip hugs the top of the pane's old rectangle, and the panes below grow. The panes in the lower half fold down, and the panes above grow. A pane in the exact middle folds up.
| Panes in the column | Fold up (panes below grow) | Fold down (panes above grow) |
|---|---|---|
| 2 | 1st | 2nd |
| 3 | 1st, 2nd | 3rd |
| 4 | 1st, 2nd | 3rd, 4th |
In a row, the panes in the left half fold left and the panes to their right grow. The panes in the right half fold right and the panes to their left grow. A pane in the exact middle folds right.
| Panes in the row | Fold left (panes to the right grow) | Fold right (panes to the left grow) |
|---|---|---|
| 2 | 1st | 2nd |
| 3 | 1st | 2nd, 3rd |
| 4 | 1st, 2nd | 3rd, 4th |
"Directly beside" means the unbroken run of unfolded panes on that side, up to the next strip. That run grows as one, and each pane in it keeps its share. Three stacked panes, before and after you fold the top pane and the middle pane:
Before Fold the top pane Fold the middle pane ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ 1 │ │▓▓ 1 ▓▓▓▓▓▓▓▓▓│ │ 1 │ │ │ ├──────────────┤ │ │ │ │ │ 2 │ │ │ ├──────────────┤ │ │ ├──────────────┤ │ 2 │ │ │ │▓▓ 2 ▓▓▓▓▓▓▓▓▓│ │ │ ├──────────────┤ ├──────────────┤ ├──────────────┤ │ 3 │ │ 3 │ │ 3 │ │ │ │ │ │ │ │ │ │ │ └──────────────┘ └──────────────┘ └──────────────┘
When you fold the top pane, panes 2 and 3 share its rows. When you fold the middle pane, it folds up, so only pane 3 grows.
A strip along a row is one text row high. A strip down a column is two columns wide, because a text cell is about twice as tall as it is wide, and this makes both kinds of strip look about equally thick. Nash draws the colored band at one cell height by default. See Configuration to change that.
A fully folded column collapses
If every pane in a column is folded, no pane is left to take the space. The column then collapses sideways: it becomes a narrow band that holds its strips stacked from top to bottom, and the column beside it takes the width.
Before All three folded ┌────────────┬─────────────┐ ┌──┬─────────────────────────┐ │ 1 │ │ │▓ │ │ ├────────────┤ │ │▓ │ │ │ 2 │ 4 │ ├──┤ │ ├────────────┤ │ │▓ │ 4 │ │ 3 │ │ │▓ │ │ └────────────┴─────────────┘ ├──┤ │ │▓ │ │ │▓ │ │ └──┴─────────────────────────┘
The strips share the column's height, and their titles read downward. Unfold one pane and the column opens at its old width. Panes that are still folded appear as one-row strips above and below the pane you unfolded.
The same happens to a row. If every pane in a row is folded, the row collapses to a single row high, its strips sit side by side, and the pane above or below takes the height. This repeats for any group that contains the collapsed one, all the way out to the tab.
Nash refuses a fold that leaves nothing visible
A fold needs at least one unfolded pane in the tab. Nash refuses to fold:
- the only pane in a tab,
- the last unfolded pane in a tab.
A refused fold changes nothing. From a shell, nash cli fold-pane prints the
error and exits with status 1. Everywhere else, Nash writes a line to its log.
Focus moves to a pane you can type in
When you fold the active pane, Nash moves focus to its closest unfolded neighbor. A column looks up, then down. A row looks right, then left. Strips are skipped. If a collapsed column leaves no neighbor on either side, Nash looks along the other axis and picks the pane beside the column.
Folding a pane that is not active leaves focus where it is. Unfolding a pane leaves focus where it is as well.
The program keeps its size
The program in a folded pane is not resized to one row. Squeezing a full-screen program such as an editor or an agent into one row would destroy its screen twice per fold. The pane keeps the size it had until you unfold it, and Nash resizes it only if the layout around it changed in the meantime.
Output continues to arrive, and the program does not see a resize. Keys you type into a selected strip still reach the program, but you cannot see them. See Fold and Unfold a Pane.
Resizing, splitting, closing, and moving
| You do this | What happens |
|---|---|
| Resize the window | Strips stay thin. The normal layout scales, and the unfolded panes share the rest. |
| Drag a divider beside a strip | The divider does not move. A strip cannot grow. |
| Drag a divider between unfolded panes | It moves. The panes keep their new ratio after you unfold the strip. |
| Resize a pane with the keyboard | The same as a drag: it does nothing next to a strip, and works between unfolded panes. |
| Split a pane beside a strip | The strip stays folded. The new pane shares the space of the pane you split. |
| Split a folded pane | Nash unfolds the pane first. A strip has no room for a second pane. |
| Fold with Toggle Pane Fold while a pane is maximized | Nash restores the layout first, then folds. |
| Close the pane that took the space | The strip stays folded. With nothing left on its side, its space goes to the other side. When you unfold it, it gets the rows the closed pane left. |
| Close a folded pane | Nash drops its fold. The other strips of a collapsed column stay folded. |
| Swap or rotate panes | A folded pane takes its fold with it to its new place. |
| Move a pane to a new tab or window | The pane arrives unfolded. |
Moving a window between displays with different screen densities also rescales the normal layout proportionally. Each pane keeps its share of the tab, subject to whole-cell rounding and minimum pane sizes; strips stay thin.
You can still maximize an unfolded pane while other panes remain folded. Explicitly select the pane you want to maximize first, then use Grow Pane. The maximized view hides the strips but does not clear their folds; restoring the layout brings the strips back.
Next
- Configuration changes how strips look.
- Persistence and Limits covers session restore, the multiplexer, and known limits.