Skip to content

Commit 7c94dcf

Browse files
committed
visualize incorrect space chars
1 parent 997cff9 commit 7c94dcf

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "thokr"
33
description = "a sleek typing tui written in rust"
4-
version = "0.3.0"
4+
version = "0.4.0"
55
readme = "README.md"
66
repository = "https://github.com/coloradocolby/thokr.git"
77
homepage = "https://github.com/coloradocolby/thokr"

src/ui.rs

+12-7
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,18 @@ impl Widget for &Thok {
6868
.iter()
6969
.enumerate()
7070
.map(|(idx, input)| {
71-
Span::styled(
72-
self.get_expected_char(idx).to_string(),
73-
match input.outcome {
74-
Outcome::Correct => green_bold_style,
75-
Outcome::Incorrect => red_bold_style,
76-
},
77-
)
71+
let expected = self.get_expected_char(idx).to_string();
72+
73+
match input.outcome {
74+
Outcome::Incorrect => Span::styled(
75+
match expected.as_str() {
76+
" " => "·".to_owned(),
77+
_ => expected,
78+
},
79+
red_bold_style,
80+
),
81+
Outcome::Correct => Span::styled(expected, green_bold_style),
82+
}
7883
})
7984
.collect::<Vec<Span>>();
8085

0 commit comments

Comments
 (0)