From a729240e9165115e681162280c861e0b68d2ed45 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Wed, 14 Feb 2024 18:23:05 -0600 Subject: [PATCH] !squash pane --- src/libtmux/pane.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/libtmux/pane.py b/src/libtmux/pane.py index 4e446ca71..d79d0a0b3 100644 --- a/src/libtmux/pane.py +++ b/src/libtmux/pane.py @@ -10,7 +10,7 @@ import warnings from typing import overload -from libtmux.common import tmux_cmd +from libtmux.common import has_gte_version, tmux_cmd from libtmux.constants import ( RESIZE_ADJUSTMENT_DIRECTION_FLAG_MAP, ResizeAdjustmentDirection, @@ -197,21 +197,20 @@ def resize_pane( elif height or width: ## Manual resizing if height: - if ( - isinstance(height, str) - and not height.isdigit() - and not height.endswith("%") - ): - raise exc.RequiresDigitOrPercentage + if isinstance(height, str): + if height.endswith("%") and not has_gte_version("3.1"): + raise exc.VersionTooLow + if not height.isdigit() and not height.endswith("%"): + raise exc.RequiresDigitOrPercentage tmux_args += (f"-y{height}",) if width: - if ( - isinstance(width, str) - and not width.isdigit() - and not width.endswith("%") - ): - raise exc.RequiresDigitOrPercentage + if isinstance(width, str): + if width.endswith("%") and not has_gte_version("3.1"): + raise exc.VersionTooLow + if not width.isdigit() and not width.endswith("%"): + raise exc.RequiresDigitOrPercentage + tmux_args += (f"-x{width}",) elif zoom: ## Zoom / Unzoom