diff options
author | 2020-06-05 08:58:34 -0700 | |
---|---|---|
committer | 2020-06-05 08:58:34 -0700 | |
commit | 6a2c73d0e0ea710f2b6acfaad2b6a6551f807352 (patch) | |
tree | 7e15e2472da432a8d9f79184b5692e35909c1366 /native | |
parent | ca6ff874a18d1027dbbcdc6059ccbc58dd2f2680 (diff) | |
download | iced-6a2c73d0e0ea710f2b6acfaad2b6a6551f807352.tar.gz iced-6a2c73d0e0ea710f2b6acfaad2b6a6551f807352.tar.bz2 iced-6a2c73d0e0ea710f2b6acfaad2b6a6551f807352.zip |
sketch of move_cursor_to commands
Diffstat (limited to 'native')
-rw-r--r-- | native/src/widget/text_input.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index e3a5355b..9e7d504a 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -683,6 +683,22 @@ impl State { pub fn cursor(&self) -> Cursor { self.cursor } + + /// Moves the [`Cursor`] of the [`TextInput`] to the front of the input text. + /// + /// [`Cursor`]: struct.Cursor.html + /// [`TextInput`]: struct.TextInput.html + pub fn move_cursor_to_front(&mut self) { + self.cursor.move_to(0); + } + + /// Moves the [`Cursor`] of the [`TextInput`] to the end of the input text. + /// + /// [`Cursor`]: struct.Cursor.html + /// [`TextInput`]: struct.TextInput.html + pub fn move_cursor_to_end(&mut self) { + self.cursor.move_to(5000); + } } // TODO: Reduce allocations |