summaryrefslogtreecommitdiffstats
path: root/contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/dimension.py
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2025-09-11 19:12:15 +0300
committerrobot-piglet <[email protected]>2025-09-11 19:43:09 +0300
commit91708f49a58e3c0a1a3cf0a60c268c2d5b474a3e (patch)
tree9dbcd5cd1811b171ca7636600287d72327ef98ec /contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/dimension.py
parentf4413504c29db8e1e7cce3a2103e89ecb4073271 (diff)
Intermediate changes
commit_hash:87ab6d7772f084decaa30c0cb439a3e0c000406e
Diffstat (limited to 'contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/dimension.py')
-rw-r--r--contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/dimension.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/dimension.py b/contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/dimension.py
index 2e6f5dd4eb1..eec6c6924c4 100644
--- a/contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/dimension.py
+++ b/contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/dimension.py
@@ -99,10 +99,6 @@ class Dimension:
"""
return cls.exact(amount=0)
- def is_zero(self) -> bool:
- "True if this `Dimension` represents a zero size."
- return self.preferred == 0 or self.max == 0
-
def __repr__(self) -> str:
fields = []
if self.min_specified:
@@ -139,11 +135,11 @@ def max_layout_dimensions(dimensions: list[Dimension]) -> Dimension:
# If all dimensions are size zero. Return zero.
# (This is important for HSplit/VSplit, to report the right values to their
# parent when all children are invisible.)
- if all(d.is_zero() for d in dimensions):
- return dimensions[0]
+ if all(d.preferred == 0 and d.max == 0 for d in dimensions):
+ return Dimension.zero()
# Ignore empty dimensions. (They should not reduce the size of others.)
- dimensions = [d for d in dimensions if not d.is_zero()]
+ dimensions = [d for d in dimensions if d.preferred != 0 and d.max != 0]
if dimensions:
# Take the highest minimum dimension.