diff options
-rw-r--r-- | native/src/widget/text_input.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index 0dbcc3d6..c821247f 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -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 |