Skip to content

Commit 55b03a6

Browse files
committed
fix constrain
1 parent 9b2fe24 commit 55b03a6

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

src/textual/_compositor.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,8 @@ def _constrain(
557557

558558
region = region.translate_inside(
559559
constrain_region.shrink(styles.margin),
560-
constrain_x == "limit",
561-
constrain_y == "limit",
560+
constrain_x == "inside",
561+
constrain_y == "inside",
562562
)
563563

564564
return region
@@ -704,6 +704,7 @@ def add_widget(
704704
widget_region = self._constrain(
705705
sub_widget.styles, widget_region, no_clip
706706
)
707+
707708
if widget._cover_widget is None:
708709
add_widget(
709710
sub_widget,

src/textual/css/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"nocolor",
7575
}
7676
VALID_OVERLAY: Final = {"none", "screen"}
77-
VALID_CONSTRAIN: Final = {"inflect", "limit", "none"}
77+
VALID_CONSTRAIN: Final = {"inflect", "inside", "none"}
7878
VALID_KEYLINE: Final = {"none", "thin", "heavy", "double"}
7979
VALID_HATCH: Final = {"left", "right", "cross", "vertical", "horizontal"}
8080
HATCHES: Final = {

src/textual/css/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
Overflow = Literal["scroll", "hidden", "auto"]
3737
EdgeStyle = Tuple[EdgeType, Color]
3838
TextAlign = Literal["left", "start", "center", "right", "end", "justify"]
39-
Constrain = Literal["none", "inflect", "limit"]
39+
Constrain = Literal["none", "inflect", "inside"]
4040
Overlay = Literal["none", "screen"]
4141

4242
Specificity3 = Tuple[int, int, int]

src/textual/widgets/_select.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ class Select(Generic[SelectType], Vertical, can_focus=True):
218218
height: auto;
219219
max-height: 12;
220220
overlay: screen;
221-
constrain: y;
221+
constrain: none inside;
222222
}
223223
224224
&:focus > SelectCurrent {

src/textual/widgets/_tooltip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Tooltip(Static, inherit_css=False):
1313
background: $background;
1414
width: auto;
1515
height: auto;
16-
constrain: limit inflect;
16+
constrain: inside inflect;
1717
max-width: 40;
1818
display: none;
1919
offset-x: -50%;

0 commit comments

Comments
 (0)