final refactors

This commit is contained in:
2026-06-11 22:17:46 -05:00
parent f249e109ed
commit 7f41f704ef
4 changed files with 26 additions and 23 deletions
+12 -1
View File
@@ -1,7 +1,6 @@
use ratatui::crossterm::event::{Event, KeyCode, MouseEventKind};
use kiln_core::Direction;
use kiln_core::game::{GameState, ScrollLine};
use crate::resolve_choice;
use crate::scroll_overlay::ScrollAnimState;
use crate::ui::Ui;
@@ -50,6 +49,18 @@ pub(crate) fn handle_board_input(event: Event, log_open: bool, terminal_h: u16,
false
}
/// Returns the choice string for the given key character, scanning the scroll lines.
fn resolve_choice(lines: &[ScrollLine], c: char) -> Option<String> {
let mut letter = b'a';
for line in lines {
if let ScrollLine::Choice { choice, .. } = line {
if c == letter as char { return Some(choice.clone()); }
letter += 1;
}
}
None
}
/// Handles an input event in [`InputMode::Scroll`].
pub(crate) fn handle_scroll_input(event: Event, game: &mut GameState, ui: &mut Ui) {
match event {