Skip to content

split_tree: rescale split ratio when resizing - #12699

Merged
jcollie merged 1 commit into
ghostty-org:mainfrom
dkinzler:fix/split-tree-resize
May 18, 2026
Merged

jcollie merged 1 commit into
ghostty-org:mainfrom
dkinzler:fix/split-tree-resize

Conversation

@dkinzler

Copy link
Copy Markdown
Contributor

Fixes SplitTree.resize not rescaling the split ratio to be relative to the size of the split. Added a unit test for resizing a nested split.

Previously the new ratio was incorrectly calculated relative to the entire grid. As a consequence resizing a nested split in the GTK app would cause unexpected size changes like large jumps. E.g. in the following recording the window has height ~1000px and the resize was done using a keybind for resize_split:up,10. The change is much larger than 10 pixels.

recording.mp4

Note that even with this fix, resizing by a small amount like 10 pixels might not work at all (depending on window size and layout), because of the same bug causing #11193 (see my PR #12698). Initially an inaccurate split ratio will be set and eventually written back to the split tree datastructure. That incorrect split ratio will be the same before and after the small resize, so nothing actually changes in the UI.

The split tree implementation for the macOS app already calculates the ratios correctly.

AI Disclosure
No AI was used, the bug was discovered and all code written by myself.

@jcollie jcollie modified the milestones: 1.4.0, 1.3.2 May 15, 2026
@jcollie
jcollie merged commit cfac861 into ghostty-org:main May 18, 2026
91 checks passed
@jcollie

jcollie commented May 18, 2026

Copy link
Copy Markdown
Member

Thanks! This combined with 12698 works quite well in my testing.

@mitchellh mitchellh modified the milestones: 1.3.2, 1.4.0 Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants