mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 12:46:42 +01:00
wip: refactor pt.5, no translate
This commit is contained in:
parent
8c37c95cc6
commit
5df08409e5
19 changed files with 389 additions and 457 deletions
|
|
@ -255,3 +255,32 @@ impl<E: Engine> Command<PhraseEditor<E>> for PhraseEditorCommand {
|
|||
Ok(None)
|
||||
}
|
||||
}
|
||||
impl Handle<Tui> for PhraseEditor<Tui> {
|
||||
fn handle (&mut self, from: &TuiInput) -> Perhaps<bool> {
|
||||
PhraseEditorCommand::execute_with_state(self, from)
|
||||
}
|
||||
}
|
||||
impl InputToCommand<Tui, PhraseEditor<Tui>> for PhraseEditorCommand {
|
||||
fn input_to_command (_: &PhraseEditor<Tui>, from: &TuiInput) -> Option<Self> {
|
||||
match from.event() {
|
||||
key!(KeyCode::Char('`')) => Some(Self::ToggleDirection),
|
||||
key!(KeyCode::Enter) => Some(Self::EnterEditMode),
|
||||
key!(KeyCode::Esc) => Some(Self::ExitEditMode),
|
||||
key!(KeyCode::Char('[')) => Some(Self::NoteLengthDec),
|
||||
key!(KeyCode::Char(']')) => Some(Self::NoteLengthInc),
|
||||
key!(KeyCode::Char('a')) => Some(Self::NoteAppend),
|
||||
key!(KeyCode::Char('s')) => Some(Self::NoteSet),
|
||||
key!(KeyCode::Char('-')) => Some(Self::TimeZoomOut),
|
||||
key!(KeyCode::Char('_')) => Some(Self::TimeZoomOut),
|
||||
key!(KeyCode::Char('=')) => Some(Self::TimeZoomIn),
|
||||
key!(KeyCode::Char('+')) => Some(Self::TimeZoomIn),
|
||||
key!(KeyCode::PageUp) => Some(Self::NotePageUp),
|
||||
key!(KeyCode::PageDown) => Some(Self::NotePageDown),
|
||||
key!(KeyCode::Up) => Some(Self::GoUp),
|
||||
key!(KeyCode::Down) => Some(Self::GoDown),
|
||||
key!(KeyCode::Left) => Some(Self::GoLeft),
|
||||
key!(KeyCode::Right) => Some(Self::GoRight),
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue