Merge pull request #1799 from Textualize/datatable-fixed-column-cursor

DataTable - allow the cursor to enter fixed columns
This commit is contained in:
Will McGugan
2023-02-15 11:08:57 +00:00
committed by GitHub
3 changed files with 60 additions and 59 deletions

View File

@@ -66,6 +66,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- `DOMNode.tree` now displays simple DOM structure only https://github.com/Textualize/textual/pull/1778
- `App.install_screen` now returns None rather than AwaitMount https://github.com/Textualize/textual/pull/1778
- `DOMNode.children` is now a simple sequence, the NodesList is exposed as `DOMNode._nodes` https://github.com/Textualize/textual/pull/1778
- `DataTable` cursor can now enter fixed columns https://github.com/Textualize/textual/pull/1799
### Fixed

View File

@@ -877,7 +877,7 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
"""Clamp a coordinate such that it falls within the boundaries of the table."""
row, column = coordinate
row = clamp(row, 0, self.row_count - 1)
column = clamp(column, self.fixed_columns, len(self.columns) - 1)
column = clamp(column, 0, len(self.columns) - 1)
return Coordinate(row, column)
def watch_cursor_type(self, old: str, new: str) -> None:

File diff suppressed because one or more lines are too long