Refactor skirmish focus handling and CellWidget API

Introduce a MoveFocusedCell enum and a BoardState.change_focused_cell
method to
centralize focus movement logic. Update skirmish keybindings to use this
new
method and simplify board rendering by directly using stored CellWidget
state.
Make CellWidget setters chainable and expose the new enum in the module
re‑exports. Remove duplicated max_offset logic and old move_* methods.
This commit is contained in:
GarandPLG committed 2026-04-07 23:20:11 +02:00
1 parent e3fea75983
commit 48483da1a4
6 files changed
+88 -57

No files matched your search

+5 -4
View File
@@ -15,13 +15,12 @@ use ratatui::{
// Base,
// }
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct CellWidget {
row: usize,
col: usize,
selected: bool,
zoom_level: ZoomLevel,
// text_area: Vec<Line>,
// pub tags: Vec<CellTags>,
}
@@ -35,12 +34,14 @@ impl CellWidget {
}
}
pub fn set_selected(&mut self, selected: bool) {
pub fn set_selected(&mut self, selected: bool) -> &mut Self {
self.selected = selected;
self
}
pub fn set_zoom_level(&mut self, zoom_level: ZoomLevel) {
pub fn set_zoom_level(&mut self, zoom_level: ZoomLevel) -> &mut Self {
self.zoom_level = zoom_level;
self
}
fn col_to_letters(&self) -> String {