Skip to content

Commit 901d31c

Browse files
authored
Merge pull request #4842 from Textualize/crop-size
remove clip_size
2 parents 9d46229 + 413c68a commit 901d31c

File tree

4 files changed

+2
-18
lines changed

4 files changed

+2
-18
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010
### Changed
1111

1212
- Input cursor will no longer jump to the end on focus https://github.com/Textualize/textual/pull/4773
13+
- Removed `Size.cip_size`, which was a clone of `crop_size`
1314

1415
### Fixed
1516

src/textual/geometry.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -627,19 +627,6 @@ def expand(self, size: tuple[int, int]) -> Region:
627627
height + expand_height * 2,
628628
)
629629

630-
def clip_size(self, size: tuple[int, int]) -> Region:
631-
"""Clip the size to fit within minimum values.
632-
633-
Args:
634-
size: Maximum width and height.
635-
636-
Returns:
637-
New region.
638-
"""
639-
x, y, width, height = self
640-
max_width, max_height = size
641-
return Region(x, y, min(width, max_width), min(height, max_height))
642-
643630
@lru_cache(maxsize=1024)
644631
def overlaps(self, other: Region) -> bool:
645632
"""Check if another region overlaps this region.

src/textual/layouts/grid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def apply_height_limits(widget: Widget, height: int) -> int:
253253
)
254254
region = (
255255
Region(x, y, int(width + margin.width), int(height + margin.height))
256-
.clip_size(cell_size)
256+
.crop_size(cell_size)
257257
.shrink(margin)
258258
)
259259
add_placement(

tests/test_geometry.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,6 @@ def test_crop_size():
210210
assert Region(10, 20, 100, 200).crop_size((500, 40)) == Region(10, 20, 100, 40)
211211

212212

213-
def test_clip_size():
214-
assert Region(10, 10, 100, 80).clip_size((50, 100)) == Region(10, 10, 50, 80)
215-
216-
217213
def test_region_overlaps():
218214
assert Region(10, 10, 30, 20).overlaps(Region(0, 0, 20, 20))
219215
assert not Region(10, 10, 5, 5).overlaps(Region(15, 15, 20, 20))

0 commit comments

Comments
 (0)