diff options
author | Joris | 2022-11-21 14:47:36 +0100 |
---|---|---|
committer | Joris | 2022-11-21 14:47:36 +0100 |
commit | ae8aafed5bad8edd594556bce079b1545aea9bec (patch) | |
tree | 88cff38eff55c9da1fc44d99dae2e72bd5a8d2eb /src/gui | |
parent | 3fbdc20859a7f795ab9396ead363ab7a9581405d (diff) |
Show errors in TUI instead of nothing
Once the terminal was setup, errors were not shown in case the
application stopped because of an error.
So, show errors explicitely in TUI to be able to debug easily the deck
for example.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/mod.rs | 2 | ||||
-rw-r--r-- | src/gui/question.rs | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/mod.rs b/src/gui/mod.rs index b39cbcf..719f39a 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -11,7 +11,7 @@ use std::{fs, io, time::Duration}; use termion::{raw::IntoRawMode, raw::RawTerminal, screen::AlternateScreen}; use tui::{backend::TermionBackend, Terminal}; -type Term = Terminal<TermionBackend<AlternateScreen<RawTerminal<io::Stdout>>>>; +pub type Term = Terminal<TermionBackend<AlternateScreen<RawTerminal<io::Stdout>>>>; pub fn terminal() -> Result<Term> { let stdout = io::stdout().into_raw_mode()?; diff --git a/src/gui/question.rs b/src/gui/question.rs index 2060cb7..426daa9 100644 --- a/src/gui/question.rs +++ b/src/gui/question.rs @@ -203,7 +203,11 @@ pub fn ask<B: Backend>( fn is_correct(input: &str, responses: &[String]) -> bool { // Remove whitespaces - let input = input.split_whitespace().map(|word| word.trim()).collect::<Vec<&str>>().join(" "); + let input = input + .split_whitespace() + .map(|word| word.trim()) + .collect::<Vec<&str>>() + .join(" "); responses .iter() |