diff options
author | 2020-06-05 09:19:46 -0700 | |
---|---|---|
committer | 2020-06-05 09:19:46 -0700 | |
commit | 98cf9c455a201fec3069f415ce2ddf5e88def242 (patch) | |
tree | 369187047fac30c0ff4f73ffd136243bdde414d6 /native | |
parent | 0d119aa73197d545f12d95e5a2549a68d3067de9 (diff) | |
download | iced-98cf9c455a201fec3069f415ce2ddf5e88def242.tar.gz iced-98cf9c455a201fec3069f415ce2ddf5e88def242.tar.bz2 iced-98cf9c455a201fec3069f415ce2ddf5e88def242.zip |
added move_cursor_to
Diffstat (limited to 'native')
-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 |