Skip to content

Commit 67ccd84

Browse files
committed
fix: use correct display position for current_mistake_position
- Change current_mistake_position to use current_position_to_display - Add comments to clarify mistake_positions vs current_mistake_position usage: * mistake_positions: typing positions for statistics * current_mistake_position: display position for highlighting - Ensures mistake highlighting works correctly in stage_renderer
1 parent ebfff51 commit 67ccd84

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/game/typing_core.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ pub struct TypingCore {
2121

2222
// Mistake tracking
2323
mistakes: usize,
24-
mistake_positions: Vec<usize>,
25-
current_mistake_position: Option<usize>,
24+
mistake_positions: Vec<usize>, // typing positions for statistics
25+
current_mistake_position: Option<usize>, // display position for highlighting
2626
}
2727

2828
#[derive(Debug, Clone, Copy)]
@@ -452,7 +452,7 @@ impl TypingCore {
452452
fn record_mistake(&mut self) {
453453
self.mistakes += 1;
454454
self.mistake_positions.push(self.current_position_to_type);
455-
self.current_mistake_position = Some(self.current_position_to_type);
455+
self.current_mistake_position = Some(self.current_position_to_display);
456456
}
457457

458458
fn clear_mistake_position(&mut self) {

0 commit comments

Comments
 (0)