mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
navigate by note_len
This commit is contained in:
parent
9b705f48e0
commit
1aa4386e42
1 changed files with 12 additions and 9 deletions
|
|
@ -614,6 +614,7 @@ impl InputToCommand<Tui, PhraseEditorModel> for PhraseCommand {
|
||||||
let time_point = state.time_point.load(Ordering::Relaxed);
|
let time_point = state.time_point.load(Ordering::Relaxed);
|
||||||
let time_zoom = state.view_mode.time_zoom();
|
let time_zoom = state.view_mode.time_zoom();
|
||||||
let length = state.phrase.as_ref().map(|p|p.read().unwrap().length).unwrap_or(1);
|
let length = state.phrase.as_ref().map(|p|p.read().unwrap().length).unwrap_or(1);
|
||||||
|
let note_len = state.note_len;
|
||||||
Some(match from.event() {
|
Some(match from.event() {
|
||||||
key!(Char('`')) => ToggleDirection,
|
key!(Char('`')) => ToggleDirection,
|
||||||
key!(Esc) => SetEditMode(PhraseEditMode::Scroll),
|
key!(Esc) => SetEditMode(PhraseEditMode::Scroll),
|
||||||
|
|
@ -633,18 +634,20 @@ impl InputToCommand<Tui, PhraseEditorModel> for PhraseCommand {
|
||||||
key!(Down) => SetNoteScroll(note_lo.saturating_sub(1)),
|
key!(Down) => SetNoteScroll(note_lo.saturating_sub(1)),
|
||||||
key!(PageUp) => SetNoteScroll(note_lo + 3),
|
key!(PageUp) => SetNoteScroll(note_lo + 3),
|
||||||
key!(PageDown) => SetNoteScroll(note_lo.saturating_sub(3)),
|
key!(PageDown) => SetNoteScroll(note_lo.saturating_sub(3)),
|
||||||
key!(Left) => SetTimeScroll(time_start.saturating_sub(1)),
|
key!(Left) => SetTimeScroll(time_start.saturating_sub(time_zoom)),
|
||||||
key!(Right) => SetTimeScroll(time_start + 1),
|
key!(Right) => SetTimeScroll(time_start + time_zoom),
|
||||||
_ => return None
|
_ => return None
|
||||||
},
|
},
|
||||||
PhraseEditMode::Note => match from.event() {
|
PhraseEditMode::Note => match from.event() {
|
||||||
key!(Char('e')) => SetEditMode(PhraseEditMode::Scroll),
|
key!(Char('e')) => SetEditMode(PhraseEditMode::Scroll),
|
||||||
key!(Up) => SetNoteCursor(note_point + 1),
|
key!(Up) => SetNoteCursor(note_point + 1),
|
||||||
key!(Down) => SetNoteCursor(note_point.saturating_sub(1)),
|
key!(Down) => SetNoteCursor(note_point.saturating_sub(1)),
|
||||||
key!(PageUp) => SetNoteCursor(note_point + 3),
|
key!(PageUp) => SetNoteCursor(note_point + 3),
|
||||||
key!(PageDown) => SetNoteCursor(note_point.saturating_sub(3)),
|
key!(PageDown) => SetNoteCursor(note_point.saturating_sub(3)),
|
||||||
key!(Left) => SetTimeCursor(time_point.saturating_sub(time_zoom)),
|
key!(Left) => SetTimeCursor(time_point.saturating_sub(note_len)),
|
||||||
key!(Right) => SetTimeCursor((time_point + time_zoom) % length),
|
key!(Right) => SetTimeCursor((time_point + note_len) % length),
|
||||||
|
key!(Shift-Left) => SetTimeCursor(time_point.saturating_sub(time_zoom)),
|
||||||
|
key!(Shift-Right) => SetTimeCursor((time_point + time_zoom) % length),
|
||||||
_ => return None
|
_ => return None
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue