From 2213c7d46bd3cd53df41cdd6a6447d3a7733ee03 Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Fri, 19 Sep 2025 20:14:07 +0100 Subject: [PATCH 1/3] Fix header height reactive change not clearing caches --- src/textual/widgets/_data_table.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/textual/widgets/_data_table.py b/src/textual/widgets/_data_table.py index b78ce528a1..95a871c1e0 100644 --- a/src/textual/widgets/_data_table.py +++ b/src/textual/widgets/_data_table.py @@ -35,12 +35,8 @@ CellCacheKey: TypeAlias = ( "tuple[RowKey, ColumnKey, Style, bool, bool, bool, int, PseudoClasses]" ) -LineCacheKey: TypeAlias = ( - "tuple[int, int, int, int, Coordinate, Coordinate, Style, CursorType, bool, int, PseudoClasses]" -) -RowCacheKey: TypeAlias = ( - "tuple[RowKey, int, Style, Coordinate, Coordinate, CursorType, bool, bool, int, PseudoClasses]" -) +LineCacheKey: TypeAlias = "tuple[int, int, int, int, Coordinate, Coordinate, Style, CursorType, bool, int, PseudoClasses]" +RowCacheKey: TypeAlias = "tuple[RowKey, int, Style, Coordinate, Coordinate, CursorType, bool, bool, int, PseudoClasses]" CursorType = Literal["cell", "row", "column", "none"] """The valid types of cursors for [`DataTable.cursor_type`][textual.widgets.DataTable.cursor_type].""" CellType = TypeVar("CellType") @@ -1160,6 +1156,9 @@ def watch_fixed_columns(self) -> None: def watch_zebra_stripes(self) -> None: self._clear_caches() + def watch_header_height(self) -> None: + self._clear_caches() + def validate_cell_padding(self, cell_padding: int) -> int: return max(cell_padding, 0) From 565a8d4b1ab20563fbe36dffa69170b95018a238 Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Fri, 19 Sep 2025 20:19:42 +0100 Subject: [PATCH 2/3] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76f269007d..e02df616f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - Fixed issue where Segments with a style of `None` aren't rendered https://github.com/Textualize/textual/pull/6109 +- Fixed visual glitches and crash when changing `DataTable.header_height` https://github.com/Textualize/textual/pull/6128 ## [6.1.0] - 2025-08-01 From 6b4423c5438e29dc47d5b870e387fe7bb1f57a2a Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Fri, 19 Sep 2025 20:26:31 +0100 Subject: [PATCH 3/3] Formatting --- src/textual/widgets/_data_table.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/textual/widgets/_data_table.py b/src/textual/widgets/_data_table.py index 95a871c1e0..f7a8271874 100644 --- a/src/textual/widgets/_data_table.py +++ b/src/textual/widgets/_data_table.py @@ -35,8 +35,12 @@ CellCacheKey: TypeAlias = ( "tuple[RowKey, ColumnKey, Style, bool, bool, bool, int, PseudoClasses]" ) -LineCacheKey: TypeAlias = "tuple[int, int, int, int, Coordinate, Coordinate, Style, CursorType, bool, int, PseudoClasses]" -RowCacheKey: TypeAlias = "tuple[RowKey, int, Style, Coordinate, Coordinate, CursorType, bool, bool, int, PseudoClasses]" +LineCacheKey: TypeAlias = ( + "tuple[int, int, int, int, Coordinate, Coordinate, Style, CursorType, bool, int, PseudoClasses]" +) +RowCacheKey: TypeAlias = ( + "tuple[RowKey, int, Style, Coordinate, Coordinate, CursorType, bool, bool, int, PseudoClasses]" +) CursorType = Literal["cell", "row", "column", "none"] """The valid types of cursors for [`DataTable.cursor_type`][textual.widgets.DataTable.cursor_type].""" CellType = TypeVar("CellType")