diff options
author | 2019-11-14 06:48:12 +0100 | |
---|---|---|
committer | 2019-11-14 06:48:12 +0100 | |
commit | af5ec4941270c832557994d9b4cc70ce5feac911 (patch) | |
tree | 7ea832e70007aeef958ac40b525783f590ff2d26 /native/src/widget/text_input.rs | |
parent | a16dab9cf2e27cb933cc91383ca79ba8e188c4c2 (diff) | |
parent | be5466a0a7ee6a16b5c07e61c9a22068ad8e127f (diff) | |
download | iced-af5ec4941270c832557994d9b4cc70ce5feac911.tar.gz iced-af5ec4941270c832557994d9b4cc70ce5feac911.tar.bz2 iced-af5ec4941270c832557994d9b4cc70ce5feac911.zip |
Merge pull request #55 from hecrj/example/edit-todos
Edit and delete todos
Diffstat (limited to 'native/src/widget/text_input.rs')
-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 7e81e257..35e10000 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -11,6 +11,10 @@ where Renderer: self::Renderer, Message: Clone + std::fmt::Debug, { + fn width(&self) -> Length { + self.width + } + fn layout( &self, renderer: &Renderer, @@ -46,6 +50,10 @@ where }) => { self.state.is_focused = layout.bounds().contains(cursor_position); + + if self.state.cursor_position(&self.value) == 0 { + self.state.move_cursor_to_end(&self.value); + } } Event::Keyboard(keyboard::Event::CharacterReceived(c)) if self.state.is_focused && !c.is_control() => |