added input whitespace cleanup and resolved unused function warning

This commit is contained in:
magnusKue
2024-11-25 20:35:48 +01:00
parent 281d688f0e
commit 71afe6df1d
+3 -6
View File
@@ -14,7 +14,7 @@ use cml_functions::*;
// [ ] Proper has_max_len (see below)
// [x] Allow full caps translation (_YU / _Yu)
// [x] Allow typing within text
// [ ] Clean up result (whitespaces)
// [x] Clean up result (whitespaces)
//
// BUG:
// [x] Space -> Arrow left -> backspace -> panic
@@ -24,10 +24,6 @@ use cml_functions::*;
// [x] special letter -> left -> space -> cursor pos wrong
fn main() {
let result = diff_string_copy("hellollo".to_string(), "hello".to_string());
println!("\n{:?}", result);
loop {
let learned_word = learn_new_word();
if learned_word.is_none() {
@@ -60,7 +56,7 @@ async fn learn_new_word() -> Option<String> {
let input = input_opt.unwrap().to_string();
//println!("] '{}'", input);
if input == vocab_tr {
if input.trim() == vocab_tr {
println!("Well done!");
}
else {
@@ -73,6 +69,7 @@ async fn learn_new_word() -> Option<String> {
Some(vocab.to_string())
}
#[allow(unused)]
fn diff_string_copy(original: String, copy: String) -> Vec<u16> {
let mut diff_indicies: Vec<u16> = Vec::new();
let mut cp = copy.chars();