Skip to content

Commit 215c8b4

Browse files
committed
mcp(fix[pane_tools]): Query tmux for zoom state instead of missing attr
why: `getattr(window, "window_zoomed_flag", "0")` always returned the default `"0"` because `window_zoomed_flag` is not a field on libtmux's `Window` object. This caused `zoom=True` on an already-zoomed pane to toggle it OFF (since `pane.resize(zoom=True)` is a toggle), and `zoom=False` on a zoomed pane to be a no-op. what: - Query zoom state via `window.cmd("display-message", "-p", "#{window_zoomed_flag}")` - Preserve idempotent semantics: zoom=True ensures zoomed, zoom=False ensures unzoomed
1 parent ef0ab7d commit 215c8b4

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/libtmux/mcp/tools/pane_tools.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ def resize_pane(
160160
)
161161
if zoom is not None:
162162
window = pane.window
163-
is_zoomed = getattr(window, "window_zoomed_flag", "0") == "1"
163+
result = window.cmd("display-message", "-p", "#{window_zoomed_flag}")
164+
is_zoomed = bool(result.stdout) and result.stdout[0] == "1"
164165
if zoom and not is_zoomed:
165166
pane.resize(zoom=True)
166167
elif not zoom and is_zoomed:

0 commit comments

Comments
 (0)