mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Ensure row_key is included in RowHighlighted event
This commit is contained in:
@@ -416,8 +416,13 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
|
|||||||
self._row_render_cache: LRUCache[
|
self._row_render_cache: LRUCache[
|
||||||
RowCacheKey, tuple[SegmentLines, SegmentLines]
|
RowCacheKey, tuple[SegmentLines, SegmentLines]
|
||||||
] = LRUCache(1000)
|
] = LRUCache(1000)
|
||||||
|
"""For each row (a row can have a height of multiple lines), we maintain a cache
|
||||||
|
of the fixed and scrollable lines within that row to minimise how often we need to
|
||||||
|
re-render it."""
|
||||||
self._cell_render_cache: LRUCache[CellCacheKey, SegmentLines] = LRUCache(10000)
|
self._cell_render_cache: LRUCache[CellCacheKey, SegmentLines] = LRUCache(10000)
|
||||||
|
"""Cache for individual cells."""
|
||||||
self._line_cache: LRUCache[LineCacheKey, Strip] = LRUCache(1000)
|
self._line_cache: LRUCache[LineCacheKey, Strip] = LRUCache(1000)
|
||||||
|
"""Cache for lines within rows."""
|
||||||
|
|
||||||
self._require_update_dimensions: bool = False
|
self._require_update_dimensions: bool = False
|
||||||
"""Set to re-calculate dimensions on idle."""
|
"""Set to re-calculate dimensions on idle."""
|
||||||
@@ -673,7 +678,8 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
|
|||||||
self.refresh_row(row_index)
|
self.refresh_row(row_index)
|
||||||
is_valid_row = row_index < len(self.data)
|
is_valid_row = row_index < len(self.data)
|
||||||
if is_valid_row:
|
if is_valid_row:
|
||||||
self.emit_no_wait(DataTable.RowHighlighted(self, row_index))
|
row_key = self._row_locations.get_key(row_index)
|
||||||
|
self.emit_no_wait(DataTable.RowHighlighted(self, row_index, row_key))
|
||||||
|
|
||||||
def _highlight_column(self, column_index: int) -> None:
|
def _highlight_column(self, column_index: int) -> None:
|
||||||
"""Apply highlighting to the column at the given index, and emit event."""
|
"""Apply highlighting to the column at the given index, and emit event."""
|
||||||
|
|||||||
Reference in New Issue
Block a user