|
10 | 10 | import warnings
|
11 | 11 | from typing import overload
|
12 | 12 |
|
13 |
| -from libtmux.common import tmux_cmd |
| 13 | +from libtmux.common import has_gte_version, tmux_cmd |
14 | 14 | from libtmux.constants import (
|
15 | 15 | RESIZE_ADJUSTMENT_DIRECTION_FLAG_MAP,
|
16 | 16 | ResizeAdjustmentDirection,
|
@@ -197,21 +197,20 @@ def resize_pane(
|
197 | 197 | elif height or width:
|
198 | 198 | ## Manual resizing
|
199 | 199 | if height:
|
200 |
| - if ( |
201 |
| - isinstance(height, str) |
202 |
| - and not height.isdigit() |
203 |
| - and not height.endswith("%") |
204 |
| - ): |
205 |
| - raise exc.RequiresDigitOrPercentage |
| 200 | + if isinstance(height, str): |
| 201 | + if height.endswith("%") and not has_gte_version("3.1"): |
| 202 | + raise exc.VersionTooLow |
| 203 | + if not height.isdigit() and not height.endswith("%"): |
| 204 | + raise exc.RequiresDigitOrPercentage |
206 | 205 | tmux_args += (f"-y{height}",)
|
207 | 206 |
|
208 | 207 | if width:
|
209 |
| - if ( |
210 |
| - isinstance(width, str) |
211 |
| - and not width.isdigit() |
212 |
| - and not width.endswith("%") |
213 |
| - ): |
214 |
| - raise exc.RequiresDigitOrPercentage |
| 208 | + if isinstance(width, str): |
| 209 | + if width.endswith("%") and not has_gte_version("3.1"): |
| 210 | + raise exc.VersionTooLow |
| 211 | + if not width.isdigit() and not width.endswith("%"): |
| 212 | + raise exc.RequiresDigitOrPercentage |
| 213 | + |
215 | 214 | tmux_args += (f"-x{width}",)
|
216 | 215 | elif zoom:
|
217 | 216 | ## Zoom / Unzoom
|
|
0 commit comments