summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorLibravatar bansheerubber <gary.cactus.email@gmail.com>2020-06-05 09:19:46 -0700
committerLibravatar bansheerubber <gary.cactus.email@gmail.com>2020-06-05 09:19:46 -0700
commit98cf9c455a201fec3069f415ce2ddf5e88def242 (patch)
tree369187047fac30c0ff4f73ffd136243bdde414d6 /native
parent0d119aa73197d545f12d95e5a2549a68d3067de9 (diff)
downloadiced-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.rs8
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