zellij-org / zellij

A terminal workspace with batteries included
https://zellij.dev
MIT License
21.93k stars 666 forks source link

fix(tab): focus largest pane instead of topmost #3795

Open Pyxels opened 1 day ago

Pyxels commented 1 day ago

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.

Current Behaviour

When switching tabs in MoveTabOrFocus, pick the one at the border, if multiple, pick the topmost.

Fixed Behaviour

When switching tabs in MoveTabOrFocus, pick the one at the border, if multiple, pick the largest, then the topmost.

This ensures that when stacked panes are used, the previously focused is once again focused instead of always using the first.

Considerations

This should not influence existing workflows using normal tiled panes all to much, since the previous implementation was quite arbitrary anyway, but is a big fix for stacked layouts, since this "keeps the layout" instead of resetting.

closes #3006