aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoris2022-09-12 08:47:20 +0200
committerJoris2022-09-12 08:47:20 +0200
commitf12e337cd88dfa34035e73facd06c061f1d7ac11 (patch)
treebd38fd8330ea97409eafcc9c88499d4309877e31
parent11984f74c5785562a4aff210f50fd75dc3a97cb8 (diff)
downloadflashcards-f12e337cd88dfa34035e73facd06c061f1d7ac11.tar.gz
flashcards-f12e337cd88dfa34035e73facd06c061f1d7ac11.tar.bz2
flashcards-f12e337cd88dfa34035e73facd06c061f1d7ac11.zip
React to C-u and C-w keys
-rw-r--r--src/gui/question.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/question.rs b/src/gui/question.rs
index 55c099d..81347b5 100644
--- a/src/gui/question.rs
+++ b/src/gui/question.rs
@@ -144,6 +144,14 @@ pub fn ask<B: Backend>(
Key::Backspace => {
state.input.pop();
}
+ Key::Ctrl('u') => {
+ state.input.clear();
+ }
+ Key::Ctrl('w') => {
+ let mut words = state.input.split_whitespace().collect::<Vec<&str>>();
+ words.truncate(words.len() - 1);
+ state.input = words.join(" ");
+ }
_ => {}
},
Answer::Difficulty {