From cb32326fe6a57c3b4989741d88998fcafbf8e1ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Wed, 25 Mar 2020 14:03:15 +0100 Subject: [PATCH] Fix edge cases when inserting text in `Editor` --- native/src/widget/text_input/editor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/native/src/widget/text_input/editor.rs b/native/src/widget/text_input/editor.rs index 30025016..37093a70 100644 --- a/native/src/widget/text_input/editor.rs +++ b/native/src/widget/text_input/editor.rs @@ -17,8 +17,8 @@ impl<'a> Editor<'a> { pub fn insert(&mut self, character: char) { match self.cursor.selection() { Some((left, right)) => { - self.value.remove_many(left, right); self.cursor.move_left(&self.value); + self.value.remove_many(left, right); } _ => (), } @@ -32,8 +32,8 @@ impl<'a> Editor<'a> { match self.cursor.selection() { Some((left, right)) => { - self.value.remove_many(left, right); self.cursor.move_left(&self.value); + self.value.remove_many(left, right); } _ => (), }