splits: make resize_split and toggle_split_zoom non-performable with single pane

When a tab contains only a single split, resize_split and toggle_split_zoom
actions now return false (not performed). This allows keybindings marked with
`performable: true` to pass the event through to the terminal program.

The performable flag causes unperformed actions to be treated as if the
binding didn't exist, so the key event is sent to the terminal instead of
being consumed.

- Add isSplit() helper to SplitTree to detect single-pane vs split state
- Update GTK resizeSplit/toggleSplitZoom to return false when single pane
- Update macOS resizeSplit/toggleSplitZoom to return Bool and check isSplit
- Add unit test for isSplit method
This commit is contained in:
Steven Lu
2026-01-19 17:34:34 +07:00
parent 250877eff6
commit 6db4e437ca
3 changed files with 83 additions and 12 deletions

View File

@@ -2400,10 +2400,14 @@ const Action = struct {
SplitTree,
surface.as(gtk.Widget),
) orelse {
log.warn("surface is not in a split tree, ignoring goto_split", .{});
log.warn("surface is not in a split tree, ignoring resize_split", .{});
return false;
};
// If the tree has no splits (only one leaf), this action is not performable.
// This allows the key event to pass through to the terminal.
if (!tree.isSplit()) return false;
return tree.resize(
switch (value.direction) {
.up => .up,
@@ -2550,6 +2554,18 @@ const Action = struct {
.surface => |core| {
// TODO: pass surface ID when we have that
const surface = core.rt_surface.surface;
const tree = ext.getAncestor(
SplitTree,
surface.as(gtk.Widget),
) orelse {
log.warn("surface is not in a split tree, ignoring toggle_split_zoom", .{});
return false;
};
// If the tree has no splits (only one leaf), this action is not performable.
// This allows the key event to pass through to the terminal.
if (!tree.isSplit()) return false;
return surface.as(gtk.Widget).activateAction("split-tree.zoom", null) != 0;
},
}