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 zellij-org#3006
  • Loading branch information
Pyxels committed Nov 21, 2024
1 parent f58a889 commit 31b82cb
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 31b82cb

Please sign in to comment.