Skip to content

Commit

Permalink
fix(tab): focus largest pane instead of topmost
Browse files Browse the repository at this point in the history
When multiple Panes have the same x coord in a MoveTabOrFocus event that switches tabs, instead of picking the pane at the top to focus, choose the one biggest one. This ensures that in stacked layouts, the focused pane is opened again when moving, instead of always focusing the top pane.

closes #3006
  • Loading branch information
Pyxels committed Jan 7, 2025
1 parent 3dda02f commit 424ea18
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions zellij-server/src/panes/tiled_panes/tiled_pane_grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1039,14 +1039,14 @@ impl<'a> TiledPaneGrid<'a> {
Direction::Left => {
let x_comparison = a.x().cmp(&b.x());
match x_comparison {
Ordering::Equal => b.y().cmp(&a.y()),
Ordering::Equal => a.rows().cmp(&b.rows()).then(b.y().cmp(&a.y())),
_ => x_comparison,
}
},
Direction::Right => {
let x_comparison = b.x().cmp(&a.x());
match x_comparison {
Ordering::Equal => b.y().cmp(&a.y()),
Ordering::Equal => a.rows().cmp(&b.rows()).then(b.y().cmp(&a.y())),
_ => x_comparison,
}
},
Expand Down

0 comments on commit 424ea18

Please sign in to comment.