Skip to content

Commit

Permalink
!squash pane
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Feb 15, 2024
1 parent 10dc940 commit a729240
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/libtmux/pane.py
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a729240

Please sign in to comment.