mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
merge
This commit is contained in:
8
sandbox/will/fill.css
Normal file
8
sandbox/will/fill.css
Normal file
@@ -0,0 +1,8 @@
|
||||
App Static {
|
||||
border: heavy white;
|
||||
background: blue;
|
||||
color: white;
|
||||
height: 100%;
|
||||
|
||||
box-sizing: border-box;
|
||||
}
|
||||
10
sandbox/will/fill.py
Normal file
10
sandbox/will/fill.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.widgets import Static
|
||||
|
||||
|
||||
class FillApp(App):
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Static("Hello")
|
||||
|
||||
|
||||
app = FillApp(css_path="fill.css")
|
||||
@@ -67,7 +67,7 @@ def get_box_model(
|
||||
content_width = styles_width.resolve_dimension(
|
||||
sizing_container - styles.margin.totals, viewport, fraction_unit
|
||||
)
|
||||
if is_border_box and not styles_width.is_percent:
|
||||
if is_border_box and styles_width.excludes_border:
|
||||
content_width -= gutter.width
|
||||
|
||||
if styles.min_width is not None:
|
||||
@@ -99,7 +99,7 @@ def get_box_model(
|
||||
content_height = styles_height.resolve_dimension(
|
||||
sizing_container - styles.margin.totals, viewport, fraction_unit
|
||||
)
|
||||
if is_border_box and not styles_height.is_percent:
|
||||
if is_border_box and styles_height.excludes_border:
|
||||
content_height -= gutter.height
|
||||
|
||||
if styles.min_height is not None:
|
||||
|
||||
@@ -37,6 +37,8 @@ class Unit(Enum):
|
||||
AUTO = 8
|
||||
|
||||
|
||||
UNIT_EXCLUDES_BORDER = {Unit.CELLS, Unit.FRACTION, Unit.VIEW_WIDTH, Unit.VIEW_HEIGHT}
|
||||
|
||||
UNIT_SYMBOL = {
|
||||
Unit.CELLS: "",
|
||||
Unit.FRACTION: "fr",
|
||||
@@ -204,6 +206,10 @@ class Scalar(NamedTuple):
|
||||
"""Check if the unit is a fraction."""
|
||||
return self.unit == Unit.FRACTION
|
||||
|
||||
@property
|
||||
def excludes_border(self) -> bool:
|
||||
return self.unit in UNIT_EXCLUDES_BORDER
|
||||
|
||||
@property
|
||||
def cells(self) -> int | None:
|
||||
"""Check if the unit is explicit cells."""
|
||||
|
||||
Reference in New Issue
Block a user