added move_cursor_to

This commit is contained in:
bansheerubber 2020-06-05 09:19:46 -07:00
parent 0d119aa731
commit 98cf9c455a

View file

@ -699,6 +699,14 @@ impl State {
pub fn move_cursor_to_end(&mut self, value: &String) {
self.cursor.move_to(value.len());
}
/// Moves the [`Cursor`] of the [`TextInput`] to an arbitrary location.
///
/// [`Cursor`]: struct.Cursor.html
/// [`TextInput`]: struct.TextInput.html
pub fn move_cursor_to(&mut self, position: usize) {
self.cursor.move_to(position);
}
}
// TODO: Reduce allocations