diff --git a/src/views/select_view.rs b/src/views/select_view.rs index 5dd47ef..d6ce2f3 100644 --- a/src/views/select_view.rs +++ b/src/views/select_view.rs @@ -324,6 +324,13 @@ impl SelectView { self.scrollbase.scroll_to(i); } + /// Sets the selection to the given position. + /// + /// Chainable variant. + pub fn selected(self, i: usize) -> Self { + self.with(|s| s.set_selection(i)) + } + /// Moves the selection up by the given number of rows. pub fn select_up(&mut self, n: usize) { self.focus_up(n);