Skip to content

gtk: never resize a split smaller than one cell - #14476

Merged
jcollie merged 4 commits into
ghostty-org:mainfrom
thomasfedb:fix-split-min-size
Oct 25, 2026
Merged

jcollie merged 4 commits into
ghostty-org:mainfrom
thomasfedb:fix-split-min-size

Conversation

@thomasfedb

Copy link
Copy Markdown
Contributor

Fixes a regression of #1297 on GTK.

Issue
Splits can be dragged or resized down to 0px, which just looks like a thick divider. The 10px minimum from #1323 was lost in the GTK rewrite.

Fix
Splits are now at least one cell plus padding in size, and the divider can't be dragged past that. This also clamps keyboard resizes.

Tested on Fedora 44. Dragging and resize_split stop at one column or line. I believe that macOS already has its own minimum and is unchanged.

First pass written with Claude Code (Claude Opus 5.5), reviewed and reprompted by me.

@ghostty-bot ghostty-bot Bot added the gtk Issues exclusive to GTK which are not OS-specific label Sep 30, 2026
Comment thread src/apprt/gtk/class/split_tree.zig Outdated
@dkinzler

dkinzler commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

One little bug I found with this is when you resize a split (with keybinds) in one direction until you have reached the minimum size, you can still further decrease the split ratio stored in the split tree until it is 0 by pressing your bind. Nothing will change visually, but if you then resize again in the other direction you might have to press your keybind multiple times before something happens or the resize will be too small, depending on the resize amount specified in your keybind.

@thomasfedb

Copy link
Copy Markdown
Contributor Author

One little bug I found with this is when you resize a split (with keybinds) in one direction until you have reached the minimum size, you can still further decrease the split ratio stored in the split tree until it is 0 by pressing your bind. Nothing will change visually, but if you then resize again in the other direction you might have to press your keybind multiple times before something happens or the resize will be too small, depending on the resize amount specified in your keybind.

@dkinzler should now be addressed.

thomasfedb and others added 2 commits October 22, 2026 01:39
Also clamp keyboard split resizes to the split size, which fixed an
assertion failure when resize_split moved past the edge of a split.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jcollie

jcollie commented Oct 21, 2026

Copy link
Copy Markdown
Member

@thomasfedb can you rebase this onto current main?

@thomasfedb
thomasfedb marked this pull request as ready for review October 21, 2026 23:24
@thomasfedb
thomasfedb requested a review from a team as a code owner October 21, 2026 23:24
@thomasfedb

Copy link
Copy Markdown
Contributor Author

@thomasfedb can you rebase this onto current main?

@jcollie done!

@jcollie jcollie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of things that I noticed:

  • A window resize will now permanently change the split ratio.
  • A padding-only config reload doesn't update the minimum.

@thomasfedb

thomasfedb commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor Author

A couple of things that I noticed:

* A window resize will now permanently change the split ratio.

* A padding-only config reload doesn't update the minimum.

@jcollie Yep, that seemed like the simplest way to avoid strange behaviour but was a tradeoff
How about the following behaviour instead:

  • When a window resize pushes a split to its minimum, the stored ratio is left alone, so the original proportions come back when the window grows.
  • When resize_split is used on a split that's being held at its minimum, the split's displayed ratio is stored first and then resized from there.

Can certainly fix the config aspect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jcollie

jcollie commented Oct 24, 2026

Copy link
Copy Markdown
Member

How about the following behaviour instead:

* When a window resize pushes a split to its minimum, the stored ratio is left alone, so the original proportions come back when the window grows.

* When resize_split is used on a split that's being held at its minimum, the split's displayed ratio is stored first and then resized from there.

That seems right. I'd also hook up notify::min-position in the same way as max-position.

@jcollie

jcollie commented Oct 24, 2026

Copy link
Copy Markdown
Member

Config change update looks good.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thomasfedb

Copy link
Copy Markdown
Contributor Author

@jcollie updated as requested. Renamed propMaxPosition to propPositionLimits hope that's okay

@jcollie jcollie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI

@jcollie
jcollie enabled auto-merge October 25, 2026 01:39
@jcollie
jcollie merged commit cec8b92 into ghostty-org:main Oct 25, 2026
105 checks passed
@github-actions github-actions Bot added this to the 1.5.0 milestone Oct 25, 2026
@thomasfedb
thomasfedb deleted the fix-split-min-size branch October 25, 2026 03:09
@mitchellh mitchellh modified the milestones: 1.5.0, 1.4.0 Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gtk Issues exclusive to GTK which are not OS-specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants