fix all warns, remove moku, bind edit keys

This commit is contained in:
🪞👃🪞 2025-03-09 05:01:14 +02:00
parent 41c5686d67
commit 2903d58b2d
6 changed files with 39 additions and 81 deletions

View file

@ -16,17 +16,26 @@ impl Handle<TuiIn> for Taggart {
fn handle (&mut self, input: &TuiIn) -> Perhaps<bool> {
let x_min = self.offset;
let x_max = self.offset + self.size.h().saturating_sub(1);
match &*input.event() {
let event = &*input.event();
match event {
press!(Up) => { self.cursor = self.cursor.saturating_sub(1); },
press!(Down) => { self.cursor = self.cursor + 1; },
press!(PageUp) => { self.cursor = self.cursor.saturating_sub(PAGE_SIZE); },
press!(PageDown) => { self.cursor += PAGE_SIZE; },
press!(Left) => { self.column = self.column.saturating_sub(1); },
press!(Right) => { self.column = self.column + 1; },
press!(Enter) => { self.editing = Some((self.cursor, self.column)); },
press!(Esc) => { self.editing = None; },
press!(Char(' ')) => { open(&self.paths[self.cursor].path)?; }
_ => {}
_ => match &self.editing {
Some(_value) => match event {
press!(Enter) => todo!(),
press!(Esc) => todo!(),
_ => {}
},
None => match event {
press!(Enter) => todo!(),
_ => {}
}
}
}
if self.cursor < x_min {
self.offset = self.cursor;
@ -43,24 +52,3 @@ impl Handle<TuiIn> for Taggart {
Ok(None)
}
}
#[moku::state_machine]
mod taggart {
use moku::*;
#[machine_module] mod machine {}
use self::machine::{TaggartState, TopSuperstates};
struct Top;
impl TopState<TaggartState> for Top {}
struct Tree(usize);
#[superstate(Top)] impl State<TaggartState> for Tree {
fn enter (_: &mut TopSuperstates<'_>) -> StateEntry<Self, TaggartState> {
StateEntry::State(Self(0))
}
}
struct File(usize);
#[superstate(Top)] impl State<TaggartState> for File {
fn enter (_: &mut TopSuperstates<'_>) -> StateEntry<Self, TaggartState> {
StateEntry::State(Self(0))
}
}
}