diff --git a/CHANGELOG.md b/CHANGELOG.md index bb64a6543..4a2ba2231 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Changed +- DataTable now has height: auto by default. https://github.com/Textualize/textual/issues/2117 - Textual will now render strings within renderables (such as tables) as Console Markup by default. You can wrap your text with rich.Text() if you want the original behavior. https://github.com/Textualize/textual/issues/2120 - Some widget methods now return `self` instead of `None` https://github.com/Textualize/textual/pull/2102: - `Widget`: `refresh`, `focus`, `reset_focus` @@ -21,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `TreeNode`: `expand`, `expand_all`, `collapse`, `collapse_all`, `toggle`, `toggle_all` - `Tree`: `clear`, `reset` + ## [0.16.0] - 2023-03-22 ### Added diff --git a/src/textual/widgets/_data_table.py b/src/textual/widgets/_data_table.py index 4469f85a3..e76b092b1 100644 --- a/src/textual/widgets/_data_table.py +++ b/src/textual/widgets/_data_table.py @@ -247,6 +247,7 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True): DataTable { background: $surface ; color: $text; + height: auto; } DataTable > .datatable--header { text-style: bold; diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr index dcebac8a1..ff7adbbd0 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr +++ b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr @@ -1575,139 +1575,139 @@ font-weight: 700; } - .terminal-3464736066-matrix { + .terminal-2964420743-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-3464736066-title { + .terminal-2964420743-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-3464736066-r1 { fill: #e1e1e1 } - .terminal-3464736066-r2 { fill: #c5c8c6 } - .terminal-3464736066-r3 { fill: #454a50 } - .terminal-3464736066-r4 { fill: #e2e3e3;font-weight: bold } - .terminal-3464736066-r5 { fill: #000000 } - .terminal-3464736066-r6 { fill: #004578 } - .terminal-3464736066-r7 { fill: #dde6ed;font-weight: bold } - .terminal-3464736066-r8 { fill: #dde6ed } - .terminal-3464736066-r9 { fill: #211505 } - .terminal-3464736066-r10 { fill: #e2e3e3 } + .terminal-2964420743-r1 { fill: #e1e1e1 } + .terminal-2964420743-r2 { fill: #c5c8c6 } + .terminal-2964420743-r3 { fill: #454a50 } + .terminal-2964420743-r4 { fill: #e2e3e3;font-weight: bold } + .terminal-2964420743-r5 { fill: #000000 } + .terminal-2964420743-r6 { fill: #004578 } + .terminal-2964420743-r7 { fill: #dde6ed;font-weight: bold } + .terminal-2964420743-r8 { fill: #dde6ed } + .terminal-2964420743-r9 { fill: #211505 } + .terminal-2964420743-r10 { fill: #e2e3e3 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - ContentSwitcherApp + ContentSwitcherApp - + - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - DataTableMarkdown - ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - ────────────────────────────────────────────────────────────────────── -  Book                                 Year  -  Dune                                 1965  -  Dune Messiah                         1969  -  Children of Dune                     1976  -  God Emperor of Dune                  1981  -  Heretics of Dune                     1984  -  Chapterhouse: Dune                   1985  - - - - - - - - - - - ────────────────────────────────────────────────────────────────────── + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + DataTableMarkdown + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + ────────────────────────────────────────────────────────────────────── +  Book                                 Year  +  Dune                                 1965  +  Dune Messiah                         1969  +  Children of Dune                     1976  +  God Emperor of Dune                  1981  +  Heretics of Dune                     1984  +  Chapterhouse: Dune                   1985  + + + + + + + + + + + ────────────────────────────────────────────────────────────────────── diff --git a/tests/snapshot_tests/snapshot_apps/auto-table.py b/tests/snapshot_tests/snapshot_apps/auto-table.py index 49a6c1842..9e7f70b00 100644 --- a/tests/snapshot_tests/snapshot_apps/auto-table.py +++ b/tests/snapshot_tests/snapshot_apps/auto-table.py @@ -69,6 +69,7 @@ class Status(LabeledBox): Status StatusTable { width: auto; + height: 100%; margin-top: 1; scrollbar-gutter: stable; overflow-x: hidden; diff --git a/tests/test_data_table.py b/tests/test_data_table.py index c906754ee..74c809dd6 100644 --- a/tests/test_data_table.py +++ b/tests/test_data_table.py @@ -646,6 +646,7 @@ async def test_hover_coordinate(): table.add_column("ABC") table.add_row("123") table.add_row("456") + await pilot.pause() assert table.hover_coordinate == Coordinate(0, 0) await pilot.hover(DataTable, offset=Offset(2, 2)) assert table.hover_coordinate == Coordinate(1, 0)