aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoris2022-09-12 08:47:09 +0200
committerJoris2022-09-12 08:47:09 +0200
commit11984f74c5785562a4aff210f50fd75dc3a97cb8 (patch)
tree0ec8507a4ffa06d5170ad29fc4b6b1a2d78c3b17 /src
parent20ba5a4363f977adaa1a811fb6e6771123cfb50d (diff)
Trim input when checking responses
Diffstat (limited to 'src')
-rw-r--r--src/gui/question.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gui/question.rs b/src/gui/question.rs
index 5f060e3..55c099d 100644
--- a/src/gui/question.rs
+++ b/src/gui/question.rs
@@ -169,6 +169,9 @@ pub fn ask<B: Backend>(
}
fn is_correct(input: &str, responses: &[String]) -> bool {
+ // Trim input
+ let input = input.trim();
+
responses
.iter()
.map(|r| r.split('(').collect::<Vec<&str>>()[0].trim())