diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b2ca43249..03be1199c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/textual/widgets/_data_table.py b/src/textual/widgets/_data_table.py index eb31f3f20e..3a3d5e1004 100644 --- a/src/textual/widgets/_data_table.py +++ b/src/textual/widgets/_data_table.py @@ -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: diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr index 2bd561cf88..f149ea09fe 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr +++ b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr @@ -10015,134 +10015,134 @@ font-weight: 700; } - .terminal-3966238525-matrix { + .terminal-234487613-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-3966238525-title { + .terminal-234487613-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-3966238525-r1 { fill: #dde6ed;font-weight: bold } - .terminal-3966238525-r2 { fill: #1e1201;font-weight: bold } - .terminal-3966238525-r3 { fill: #e1e1e1 } - .terminal-3966238525-r4 { fill: #c5c8c6 } - .terminal-3966238525-r5 { fill: #211505 } + .terminal-234487613-r1 { fill: #dde6ed;font-weight: bold } + .terminal-234487613-r2 { fill: #1e1201;font-weight: bold } + .terminal-234487613-r3 { fill: #e1e1e1 } + .terminal-234487613-r4 { fill: #c5c8c6 } + .terminal-234487613-r5 { fill: #211505 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - TableApp + TableApp - - - -  lane  swimmer               country        time   -  4     Joseph Schooling      Singapore      50.39  -  2     Michael Phelps        United States  51.14  -  5     Chad le Clos          South Africa   51.14  -  6     László Cseh           Hungary        51.14  -  3     Li Zhuhao             China          51.26  -  8     Mehdy Metella         France         51.58  -  7     Tom Shields           United States  51.73  -  1     Aleksandr Sadovnikov  Russia         51.84  - - - - - - - - - - - - - - + + + +  lane  swimmer               country        time   +  4     Joseph Schooling      Singapore      50.39  +  2     Michael Phelps        United States  51.14  +  5     Chad le Clos          South Africa   51.14  +  6     László Cseh           Hungary        51.14  +  3     Li Zhuhao             China          51.26  +  8     Mehdy Metella         France         51.58  +  7     Tom Shields           United States  51.73  +  1     Aleksandr Sadovnikov  Russia         51.84  + + + + + + + + + + + + + +