diff --git a/crates/tek_tui/src/tui_input.rs b/crates/tek_tui/src/tui_input.rs index e88b6583..d15eb1f1 100644 --- a/crates/tek_tui/src/tui_input.rs +++ b/crates/tek_tui/src/tui_input.rs @@ -248,8 +248,12 @@ impl InputToCommand for PhrasesCommand { let index = state.phrase_index(); let count = state.phrases().len(); Some(match input.event() { - key!(Up) => Self::Select(0), - key!(Down) => Self::Select(0), + key!(Up) => Self::Select( + state.phrase_index().overflowing_sub(1).0.min(state.phrases().len() - 1) + ), + key!(Down) => Self::Select( + state.phrase_index().saturating_add(1) % state.phrases().len() + ), key!(Char(',')) => if index > 1 { state.set_phrase_index(state.phrase_index().saturating_sub(1)); Self::Phrase(Pool::Swap(index - 1, index))