From 95aba6bd59a0ef58e5fa3ff35aef61db891078be Mon Sep 17 00:00:00 2001 From: unspeaker Date: Mon, 23 Dec 2024 21:14:21 +0100 Subject: [PATCH] rollover instead of crashing when out of bounds in arranger --- crates/tek/src/tui/arranger_clip.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/tek/src/tui/arranger_clip.rs b/crates/tek/src/tui/arranger_clip.rs index 0a0019be..47338b47 100644 --- a/crates/tek/src/tui/arranger_clip.rs +++ b/crates/tek/src/tui/arranger_clip.rs @@ -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)),