Consistently refer to drills as drills now, rename from lesson/practice

Also fix some issues in the stats screen.
This commit is contained in:
2026-02-15 04:44:49 +00:00
parent a51adafeb0
commit 13550505c1
16 changed files with 413 additions and 319 deletions

View File

@@ -5,17 +5,17 @@ use ratatui::text::{Line, Span};
use ratatui::widgets::{Block, Paragraph, Widget, Wrap};
use crate::session::input::CharStatus;
use crate::session::lesson::LessonState;
use crate::session::drill::DrillState;
use crate::ui::theme::Theme;
pub struct TypingArea<'a> {
lesson: &'a LessonState,
drill: &'a DrillState,
theme: &'a Theme,
}
impl<'a> TypingArea<'a> {
pub fn new(lesson: &'a LessonState, theme: &'a Theme) -> Self {
Self { lesson, theme }
pub fn new(drill: &'a DrillState, theme: &'a Theme) -> Self {
Self { drill, theme }
}
}
@@ -24,21 +24,21 @@ impl Widget for TypingArea<'_> {
let colors = &self.theme.colors;
let mut spans: Vec<Span> = Vec::new();
for (i, &target_ch) in self.lesson.target.iter().enumerate() {
if i < self.lesson.cursor {
let style = match &self.lesson.input[i] {
for (i, &target_ch) in self.drill.target.iter().enumerate() {
if i < self.drill.cursor {
let style = match &self.drill.input[i] {
CharStatus::Correct => Style::default().fg(colors.text_correct()),
CharStatus::Incorrect(_) => Style::default()
.fg(colors.text_incorrect())
.bg(colors.text_incorrect_bg())
.add_modifier(Modifier::UNDERLINED),
};
let display = match &self.lesson.input[i] {
let display = match &self.drill.input[i] {
CharStatus::Incorrect(actual) => *actual,
_ => target_ch,
};
spans.push(Span::styled(display.to_string(), style));
} else if i == self.lesson.cursor {
} else if i == self.drill.cursor {
let style = Style::default()
.fg(colors.text_cursor_fg())
.bg(colors.text_cursor_bg());