diff options
author | 2020-03-24 20:57:03 +0100 | |
---|---|---|
committer | 2020-03-24 20:57:03 +0100 | |
commit | 735d9f049c1dc3872f2699c87817a3c5e3d3c034 (patch) | |
tree | 0f5dc779cbf92f34d1d39696ad7bf637a7b24c0b /native/src | |
parent | 6c47a40730938fb59aa7fb738b460dd37f756766 (diff) | |
download | iced-735d9f049c1dc3872f2699c87817a3c5e3d3c034.tar.gz iced-735d9f049c1dc3872f2699c87817a3c5e3d3c034.tar.bz2 iced-735d9f049c1dc3872f2699c87817a3c5e3d3c034.zip |
Fix edge case in `Editor::backspace`
Diffstat (limited to 'native/src')
-rw-r--r-- | native/src/widget/text_input/editor.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/native/src/widget/text_input/editor.rs b/native/src/widget/text_input/editor.rs index de235d52..30025016 100644 --- a/native/src/widget/text_input/editor.rs +++ b/native/src/widget/text_input/editor.rs @@ -47,8 +47,8 @@ impl<'a> Editor<'a> { pub fn backspace(&mut self) { match self.cursor.selection() { Some((start, end)) => { - self.value.remove_many(start, end); self.cursor.move_left(&self.value); + self.value.remove_many(start, end); } None => { let start = self.cursor.start(&self.value); @@ -64,9 +64,8 @@ impl<'a> Editor<'a> { pub fn delete(&mut self) { match self.cursor.selection() { - Some((start, end)) => { - self.value.remove_many(start, end); - self.cursor.move_left(&self.value); + Some(_) => { + self.backspace(); } None => { let end = self.cursor.end(&self.value); |