mirror of
https://codeberg.org/unspeaker/perch.git
synced 2025-12-06 09:36:42 +01:00
stub help modal; cleanup
This commit is contained in:
parent
b157a87647
commit
4619d0ea76
9 changed files with 78 additions and 68 deletions
18
src/keys.rs
18
src/keys.rs
|
|
@ -20,9 +20,10 @@ macro_rules! press {
|
|||
};
|
||||
}
|
||||
|
||||
mod edit; pub use self::edit::*;
|
||||
mod save; pub use self::save::*;
|
||||
mod quit; pub use self::quit::*;
|
||||
mod edit;
|
||||
mod save;
|
||||
mod quit;
|
||||
mod help;
|
||||
|
||||
impl Handle<TuiIn> for Taggart {
|
||||
fn handle (&mut self, input: &TuiIn) -> Perhaps<bool> {
|
||||
|
|
@ -30,10 +31,12 @@ impl Handle<TuiIn> for Taggart {
|
|||
let max = self.offset + self.display.h().saturating_sub(1);
|
||||
let event = &*input.event();
|
||||
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(input, event, *value),
|
||||
Some(Mode::Edit { .. }) => self.handle_edit(event),
|
||||
Some(Mode::Help { page }) => self.handle_help(event, *page),
|
||||
Some(Mode::Save { choice }) => self.handle_save(event, *choice),
|
||||
Some(Mode::Quit { choice }) => self.handle_quit(input, *choice),
|
||||
None => match event {
|
||||
press!(F(1)) => { self.help_begin() },
|
||||
press!(Char('q')) => { self.quit_begin(&input) },
|
||||
press!(Char('w')) => { self.save_begin() },
|
||||
press!(Enter) => { self.edit_begin() },
|
||||
|
|
@ -48,8 +51,7 @@ impl Handle<TuiIn> for Taggart {
|
|||
press!(Char('[')) => { self.columns.0[self.column].width =
|
||||
self.columns.0[self.column].width.saturating_sub(1).max(5); }
|
||||
_ => {}
|
||||
}
|
||||
_ => todo!("{:?}", self.mode)
|
||||
},
|
||||
}
|
||||
self.clamp(min, max);
|
||||
Ok(None)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue