mirror of
https://codeberg.org/unspeaker/perch.git
synced 2025-12-06 01:26:43 +01:00
implement non-save options in modals
This commit is contained in:
parent
ef0213003a
commit
72607e482c
3 changed files with 14 additions and 4 deletions
|
|
@ -32,7 +32,7 @@ impl Handle<TuiIn> for Taggart {
|
|||
match &self.mode {
|
||||
Some(Mode::Edit { .. }) => self.mode_edit(event),
|
||||
Some(Mode::Save { value }) => self.mode_save(event, *value),
|
||||
Some(Mode::Quit { value }) => self.mode_quit(event, *value),
|
||||
Some(Mode::Quit { value }) => self.mode_quit(input, event, *value),
|
||||
None => match event {
|
||||
press!(Char('q')) => { self.quit_begin(&input) },
|
||||
press!(Char('w')) => { self.save_begin() },
|
||||
|
|
|
|||
|
|
@ -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!(),
|
||||
},
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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!(),
|
||||
},
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue