File tree Expand file tree Collapse file tree 5 files changed +205
-17
lines changed
__snapshots__/test_snapshots Expand file tree Collapse file tree 5 files changed +205
-17
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
18
18
- Change default quit key to ` ctrl+q ` https://github.com/Textualize/textual/pull/5352
19
19
- Changed delete line binding on TextArea to use ` ctrl+shift+x ` https://github.com/Textualize/textual/pull/5352
20
20
21
+ ### Fixed
22
+
23
+ - Fixed issue with alignment in auto containers https://github.com/Textualize/textual/pull/5360
24
+
21
25
## [ 0.89.1] - 2024-11-05
22
26
23
27
### Fixed
Original file line number Diff line number Diff line change @@ -256,22 +256,11 @@ def get_content_height(
256
256
Returns:
257
257
Content height (in lines).
258
258
"""
259
- if not widget ._nodes :
260
- height = 0
261
- else :
262
- # Use a height of zero to ignore relative heights
263
- styles_height = widget .styles .height
264
- if widget ._parent and len (widget ._nodes ) == 1 :
265
- # If it is an only child with height auto we want it to expand
266
- height = (
267
- container .height
268
- if styles_height is not None and styles_height .is_auto
269
- else 0
270
- )
271
- else :
272
- height = 0
273
- arrangement = widget ._arrange (Size (width , height ))
259
+ if widget ._nodes :
260
+ arrangement = widget ._arrange (Size (width , 0 ))
274
261
height = arrangement .total_region .bottom
262
+ else :
263
+ height = 0
275
264
276
265
return height
277
266
Original file line number Diff line number Diff line change 3
3
4
4
5
5
class HappyDataTableFunApp (App [None ]):
6
- """The DataTable should expand as if it has height 1fr ."""
6
+ """The DataTable should expand to full the screen and show a horizontal scrollbar ."""
7
7
8
8
CSS = """
9
+ #s {
10
+ max-height: 100%;
11
+ }
9
12
DataTable {
10
13
max-height: 100%;
11
14
}
Original file line number Diff line number Diff line change @@ -1385,7 +1385,7 @@ def test_vertical_max_height(snap_compare):
1385
1385
1386
1386
1387
1387
def test_max_height_100 (snap_compare ):
1388
- """Test vertical max height takes border in to account ."""
1388
+ """Test a datatable with max height 100% ."""
1389
1389
assert snap_compare (SNAPSHOT_APPS_DIR / "max_height_100.py" )
1390
1390
1391
1391
@@ -3074,3 +3074,40 @@ def compose(self):
3074
3074
yield MainContainer ()
3075
3075
3076
3076
snap_compare (Test1 ())
3077
+
3078
+
3079
+ def test_auto_parent_with_alignment (snap_compare ):
3080
+ class Sidebar (Vertical ):
3081
+ DEFAULT_CSS = """
3082
+ Sidebar {
3083
+ dock: right; # Not strictly required to replicate the issue
3084
+ width: auto;
3085
+ height: auto;
3086
+ background: blue;
3087
+ align-vertical: bottom;
3088
+
3089
+ #contents {
3090
+ width: auto;
3091
+ height: auto;
3092
+ background: red;
3093
+ border: white;
3094
+ }
3095
+ }
3096
+ """
3097
+
3098
+ def compose (self ) -> ComposeResult :
3099
+ with Vertical (id = "contents" ):
3100
+ yield Button ("Start" )
3101
+ yield Button ("Stop" )
3102
+
3103
+ class FloatSidebarApp (App ):
3104
+ CSS = """
3105
+ Screen {
3106
+ layers: base sidebar;
3107
+ }
3108
+ """
3109
+
3110
+ def compose (self ) -> ComposeResult :
3111
+ yield Sidebar ()
3112
+
3113
+ snap_compare (FloatSidebarApp ())
You can’t perform that action at this time.
0 commit comments