Fix edge cases when inserting text in Editor
This commit is contained in:
parent
30f02345a8
commit
cb32326fe6
1 changed files with 2 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue