Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cursive-core/src/views/select_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,15 @@ impl<T: 'static> SelectView<T> {
.unwrap_or_else(Callback::dummy)
}

/// Replaces an item in the list.
pub fn replace_item<S>(&mut self, id: usize, label: S, value: T)
where
S: Into<StyledString>,
{
self.items[id] = Item::new(label.into(), value);
self.last_required_size = None;
}

/// Inserts an item at position `index`, shifting all elements after it to
/// the right.
pub fn insert_item<S>(&mut self, index: usize, label: S, value: T)
Expand Down