diff options
author | Joris | 2022-10-09 17:47:07 +0200 |
---|---|---|
committer | Joris | 2022-10-09 17:47:07 +0200 |
commit | fb38e8fd9ba849860e301a68cdd262b286c05711 (patch) | |
tree | 820811f412d8dd472a22d787a95bd9c6f6886253 /src/gui/question.rs | |
parent | 76e841c740701c46969cf8cfeab94dc3cef65d9a (diff) | |
download | flashcards-fb38e8fd9ba849860e301a68cdd262b286c05711.tar.gz flashcards-fb38e8fd9ba849860e301a68cdd262b286c05711.tar.bz2 flashcards-fb38e8fd9ba849860e301a68cdd262b286c05711.zip |
Format code
Diffstat (limited to 'src/gui/question.rs')
-rw-r--r-- | src/gui/question.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gui/question.rs b/src/gui/question.rs index 851c0af..37101c1 100644 --- a/src/gui/question.rs +++ b/src/gui/question.rs @@ -77,7 +77,7 @@ pub fn ask<B: Backend>( let formatted_input = match state.answer { Answer::Write => format!("{}█", state.input), - _ => state.input.clone() + _ => state.input.clone(), }; let answer = Paragraph::new(util::center_vertically(chunks[2], &formatted_input)) .style(match state.answer { @@ -160,7 +160,11 @@ pub fn ask<B: Backend>( let mut words = state.input.split_whitespace().collect::<Vec<&str>>(); if words.len() > 0 { words.truncate(words.len() - 1); - state.input = format!("{}{}", words.join(" "), if words.len() > 0 {" " } else {""}); + state.input = format!( + "{}{}", + words.join(" "), + if words.len() > 0 { " " } else { "" } + ); } } Key::Ctrl('c') => { @@ -182,7 +186,11 @@ pub fn ask<B: Backend>( state.answer = Answer::Difficulty { difficulty: *d } } } - Key::Char('\n') => return Ok(Response::Answered { difficulty: selected }), + Key::Char('\n') => { + return Ok(Response::Answered { + difficulty: selected, + }) + } _ => {} }, } |