Skip to content

Commit 46977d8

Browse files
authored
feat(list)!: add list navigation methods (first, last, previous, next) (#1159)
Also cleans up the list example significantly (see also <#1157>) Fixes: <#1159> BREAKING CHANGE: The `List` widget now clamps the selected index to the bounds of the list when navigating with `first`, `last`, `previous`, and `next`, as well as when setting the index directly with `select`.
1 parent 38bb196 commit 46977d8

File tree

4 files changed

+411
-276
lines changed

4 files changed

+411
-276
lines changed

BREAKING-CHANGES.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ This is a quick summary of the sections below:
5656

5757
## Unreleased
5858

59+
### List no clamps the selected index to list ([#1159])
60+
61+
[#1149]: https://github.com/ratatui-org/ratatui/pull/1149
62+
63+
The `List` widget now clamps the selected index to the bounds of the list when navigating with
64+
`first`, `last`, `previous`, and `next`, as well as when setting the index directly with `select`.
65+
66+
Previously selecting an index past the end of the list would show treat the list as having a
67+
selection which was not visible. Now the last item in the list will be selected instead.
68+
5969
### Prelude items added / removed ([#1149])
6070

6171
The following items have been removed from the prelude:
@@ -101,7 +111,6 @@ To update your app:
101111
+ let position: some_crate::Position = ...;
102112
```
103113

104-
[#1149]: https://github.com/ratatui-org/ratatui/pull/1149
105114

106115
### Termion is updated to 4.0 [#1106]
107116

0 commit comments

Comments
 (0)