Skip to content

Commit

Permalink
Merge pull request #1799 from Textualize/datatable-fixed-column-cursor
Browse files Browse the repository at this point in the history
DataTable - allow the cursor to enter fixed columns
  • Loading branch information
willmcgugan authored Feb 15, 2023
2 parents 4f8a6f5 + 4ea7dca commit 4f4f066
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 59 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/textual/widgets/_data_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ def _clamp_cursor_coordinate(self, coordinate: Coordinate) -> Coordinate:
"""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:
Expand Down
Loading

0 comments on commit 4f4f066

Please sign in to comment.