summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
Diffstat (limited to 'native')
-rw-r--r--native/src/widget/text_input/editor.rs21
1 files changed, 10 insertions, 11 deletions
diff --git a/native/src/widget/text_input/editor.rs b/native/src/widget/text_input/editor.rs
index 37093a70..71c4f292 100644
--- a/native/src/widget/text_input/editor.rs
+++ b/native/src/widget/text_input/editor.rs
@@ -17,14 +17,14 @@ impl<'a> Editor<'a> {
pub fn insert(&mut self, character: char) {
match self.cursor.selection() {
Some((left, right)) => {
- self.cursor.move_left(&self.value);
+ self.cursor.move_left(self.value);
self.value.remove_many(left, right);
}
_ => (),
}
- self.value.insert(self.cursor.end(&self.value), character);
- self.cursor.move_right(&self.value);
+ self.value.insert(self.cursor.end(self.value), character);
+ self.cursor.move_right(self.value);
}
pub fn paste(&mut self, content: Value) {
@@ -32,29 +32,28 @@ impl<'a> Editor<'a> {
match self.cursor.selection() {
Some((left, right)) => {
- self.cursor.move_left(&self.value);
+ self.cursor.move_left(self.value);
self.value.remove_many(left, right);
}
_ => (),
}
- self.value
- .insert_many(self.cursor.end(&self.value), content);
+ self.value.insert_many(self.cursor.end(self.value), content);
- self.cursor.move_right_by_amount(&self.value, length);
+ self.cursor.move_right_by_amount(self.value, length);
}
pub fn backspace(&mut self) {
match self.cursor.selection() {
Some((start, end)) => {
- self.cursor.move_left(&self.value);
+ self.cursor.move_left(self.value);
self.value.remove_many(start, end);
}
None => {
- let start = self.cursor.start(&self.value);
+ let start = self.cursor.start(self.value);
if start > 0 {
- self.cursor.move_left(&self.value);
+ self.cursor.move_left(self.value);
let _ = self.value.remove(start - 1);
}
@@ -68,7 +67,7 @@ impl<'a> Editor<'a> {
self.backspace();
}
None => {
- let end = self.cursor.end(&self.value);
+ let end = self.cursor.end(self.value);
if end < self.value.len() {
let _ = self.value.remove(end);