Skip to content

Commit

Permalink
visualize incorrect space chars
Browse files Browse the repository at this point in the history
  • Loading branch information
coloradocolby committed May 30, 2022
1 parent 997cff9 commit 7c94dcf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "thokr"
description = "a sleek typing tui written in rust"
version = "0.3.0"
version = "0.4.0"
readme = "README.md"
repository = "https://github.com/coloradocolby/thokr.git"
homepage = "https://github.com/coloradocolby/thokr"
Expand Down
19 changes: 12 additions & 7 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,18 @@ impl Widget for &Thok {
.iter()
.enumerate()
.map(|(idx, input)| {
Span::styled(
self.get_expected_char(idx).to_string(),
match input.outcome {
Outcome::Correct => green_bold_style,
Outcome::Incorrect => red_bold_style,
},
)
let expected = self.get_expected_char(idx).to_string();

match input.outcome {
Outcome::Incorrect => Span::styled(
match expected.as_str() {
" " => "·".to_owned(),
_ => expected,
},
red_bold_style,
),
Outcome::Correct => Span::styled(expected, green_bold_style),
}
})
.collect::<Vec<Span>>();

Expand Down

0 comments on commit 7c94dcf

Please sign in to comment.