implement non-save options in modals

This commit is contained in:
🪞👃🪞 2025-04-04 21:06:23 +03:00
parent ef0213003a
commit 72607e482c
3 changed files with 14 additions and 4 deletions

View file

@ -8,7 +8,7 @@ impl Taggart {
self.mode = Some(Mode::Quit { value: 1 })
}
}
pub fn mode_quit (&mut self, event: &Event, value: u8) {
pub fn mode_quit (&mut self, input: &TuiIn, event: &Event, value: u8) {
match event {
press!(Esc) => { self.mode = None },
press!(Left) => { self.mode = Some(Mode::Quit {
@ -17,7 +17,12 @@ impl Taggart {
press!(Right) => { self.mode = Some(Mode::Quit {
value: (value + 1) % 3
}) },
press!(Enter) => todo!(),
press!(Enter) => match value {
0 => { input.done() },
1 => { self.mode = None },
2 => todo!(),
_ => unreachable!(),
},
_ => {}
}
}

View file

@ -15,7 +15,12 @@ impl Taggart {
press!(Right) => { self.mode = Some(Mode::Save {
value: (value + 1) % 3
}) },
press!(Enter) => todo!(),
press!(Enter) => match value {
0 => { self.tasks = vec![]; self.mode = None; },
1 => { self.mode = None },
2 => todo!(),
_ => unreachable!(),
},
_ => {}
}
}