rollover instead of crashing when out of bounds in arranger

This commit is contained in:
🪞👃🪞 2024-12-23 21:14:21 +01:00
parent 1757fdf765
commit 95aba6bd59

View file

@ -7,9 +7,9 @@ pub fn to_arranger_clip_command (input: &TuiInput, t: usize, len_t: usize, s: us
use ArrangerClipCommand as Clip;
Some(match input.event() {
key_pat!(Char('w')) => Cmd::Select(if s > 0 { Select::Clip(t, s - 1) } else { Select::Track(t) }),
key_pat!(Char('s')) => Cmd::Select(Select::Clip(t, s + 1)),
key_pat!(Char('s')) => Cmd::Select(Select::Clip(t, (s + 1) % len_s)),
key_pat!(Char('a')) => Cmd::Select(if t > 0 { Select::Clip(t - 1, s) } else { Select::Scene(s) }),
key_pat!(Char('d')) => Cmd::Select(Select::Clip(t + 1, s)),
key_pat!(Char('d')) => Cmd::Select(Select::Clip((t + 1) % len_t, s)),
key_pat!(Char(',')) => Cmd::Clip(Clip::Set(t, s, None)),
key_pat!(Char('.')) => Cmd::Clip(Clip::Set(t, s, None)),
key_pat!(Char('<')) => Cmd::Clip(Clip::Set(t, s, None)),