From 6bc62ab358b1113b58abb199f04a099b07e9ae0c Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Sat, 8 Aug 2020 10:53:10 -0600 Subject: [PATCH] Fix backspace --- src/main.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 00ffab4..4d5a5bd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -168,7 +168,9 @@ fn tui_main(_config: &str) -> Result<(), Box> { Key::Backspace => { if app.cursor_location > 0 { app.cursor_location -= 1; - app.modify.remove(app.cursor_location); + let mut cs = app.modify.chars().collect::>(); + cs.remove(app.cursor_location); + app.modify = cs.into_iter().collect(); } } _ => {} @@ -209,7 +211,9 @@ fn tui_main(_config: &str) -> Result<(), Box> { Key::Backspace => { if app.cursor_location > 0 { app.cursor_location -= 1; - app.command.remove(app.cursor_location); + let mut cs = app.command.chars().collect::>(); + cs.remove(app.cursor_location); + app.command = cs.into_iter().collect(); } } _ => {} @@ -250,7 +254,9 @@ fn tui_main(_config: &str) -> Result<(), Box> { Key::Backspace => { if app.cursor_location > 0 { app.cursor_location -= 1; - app.command.remove(app.cursor_location); + let mut cs = app.command.chars().collect::>(); + cs.remove(app.cursor_location); + app.command = cs.into_iter().collect(); } } _ => {} @@ -281,7 +287,9 @@ fn tui_main(_config: &str) -> Result<(), Box> { Key::Backspace => { if app.cursor_location > 0 { app.cursor_location -= 1; - app.filter.remove(app.cursor_location); + let mut cs = app.filter.chars().collect::>(); + cs.remove(app.cursor_location); + app.filter = cs.into_iter().collect(); } } _ => {}