2
2
3
3
from abc import ABC , abstractmethod
4
4
from dataclasses import dataclass
5
- from fractions import Fraction
6
5
from typing import TYPE_CHECKING , ClassVar , Iterable , NamedTuple
7
6
8
7
from textual ._spatial_map import SpatialMap
@@ -238,16 +237,9 @@ def get_content_width(self, widget: Widget, container: Size, viewport: Size) ->
238
237
width = 0
239
238
else :
240
239
arrangement = widget ._arrange (
241
- Size (
242
- (
243
- int (widget ._extrema .min_width or 0 )
244
- if widget .shrink
245
- else int (widget ._extrema .apply_width (Fraction (container .width )))
246
- ),
247
- 0 ,
248
- )
240
+ Size (0 if widget .shrink else container .width , 0 )
249
241
)
250
- width = arrangement .total_region .width
242
+ width = arrangement .total_region .right
251
243
return width
252
244
253
245
def get_content_height (
@@ -265,22 +257,13 @@ def get_content_height(
265
257
Content height (in lines).
266
258
"""
267
259
if widget ._nodes :
268
- height = container .height
269
-
270
260
if not widget .styles .is_docked and all (
271
261
child .styles .is_dynamic_height for child in widget .displayed_children
272
262
):
273
263
# An exception for containers with all dynamic height widgets
274
- arrangement = widget ._arrange (
275
- Size (
276
- width ,
277
- int (widget ._extrema .apply_height (Fraction (container .height ))),
278
- )
279
- )
264
+ arrangement = widget ._arrange (Size (width , container .height ))
280
265
else :
281
- arrangement = widget ._arrange (
282
- Size (width , int (widget ._extrema .min_height or 0 ))
283
- )
266
+ arrangement = widget ._arrange (Size (width , 0 ))
284
267
height = arrangement .total_region .height
285
268
else :
286
269
height = 0
0 commit comments