Fix edge case in Editor::backspace
This commit is contained in:
parent
6c47a40730
commit
735d9f049c
@ -47,8 +47,8 @@ impl<'a> Editor<'a> {
|
|||||||
pub fn backspace(&mut self) {
|
pub fn backspace(&mut self) {
|
||||||
match self.cursor.selection() {
|
match self.cursor.selection() {
|
||||||
Some((start, end)) => {
|
Some((start, end)) => {
|
||||||
self.value.remove_many(start, end);
|
|
||||||
self.cursor.move_left(&self.value);
|
self.cursor.move_left(&self.value);
|
||||||
|
self.value.remove_many(start, end);
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
let start = self.cursor.start(&self.value);
|
let start = self.cursor.start(&self.value);
|
||||||
@ -64,9 +64,8 @@ impl<'a> Editor<'a> {
|
|||||||
|
|
||||||
pub fn delete(&mut self) {
|
pub fn delete(&mut self) {
|
||||||
match self.cursor.selection() {
|
match self.cursor.selection() {
|
||||||
Some((start, end)) => {
|
Some(_) => {
|
||||||
self.value.remove_many(start, end);
|
self.backspace();
|
||||||
self.cursor.move_left(&self.value);
|
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
let end = self.cursor.end(&self.value);
|
let end = self.cursor.end(&self.value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user