aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/question.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/question.rs b/src/gui/question.rs
index 0d9d3c2..27759f8 100644
--- a/src/gui/question.rs
+++ b/src/gui/question.rs
@@ -150,8 +150,10 @@ pub fn ask<B: Backend>(
}
Key::Ctrl('w') => {
let mut words = state.input.split_whitespace().collect::<Vec<&str>>();
- words.truncate(words.len() - 1);
- state.input = words.join(" ");
+ if words.len() > 0 {
+ words.truncate(words.len() - 1);
+ state.input = format!("{}{}", words.join(" "), if words.len() > 0 {" " } else {""});
+ }
}
_ => {}
},