mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-17 17:26:09 +03:00
Merge pull request #1323 from mitchellh/mrn/min-size-gtk-splits
gtk: respect minimum split size when using resize keys
This commit is contained in:
@ -163,10 +163,15 @@ fn removeChild(
|
|||||||
|
|
||||||
/// Move the divider in the given direction by the given amount.
|
/// Move the divider in the given direction by the given amount.
|
||||||
pub fn moveDivider(self: *Split, direction: input.SplitResizeDirection, amount: u16) void {
|
pub fn moveDivider(self: *Split, direction: input.SplitResizeDirection, amount: u16) void {
|
||||||
|
const min_pos = 10;
|
||||||
|
|
||||||
const pos = c.gtk_paned_get_position(self.paned);
|
const pos = c.gtk_paned_get_position(self.paned);
|
||||||
const new = switch (direction) {
|
const new = switch (direction) {
|
||||||
.up, .left => pos - amount,
|
.up, .left => @max(pos - amount, min_pos),
|
||||||
.down, .right => pos + amount,
|
.down, .right => new_pos: {
|
||||||
|
const max_pos: u16 = @as(u16, @intFromFloat(self.maxPosition())) - min_pos;
|
||||||
|
break :new_pos @min(pos + amount, max_pos);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
c.gtk_paned_set_position(self.paned, new);
|
c.gtk_paned_set_position(self.paned, new);
|
||||||
|
Reference in New Issue
Block a user