From 103e21d54ae0689d4c5f42757d499b06ac2919b3 Mon Sep 17 00:00:00 2001 From: Shaun Inman Date: Sat, 28 Jan 2023 20:08:08 -0500 Subject: [PATCH] only wrap on a new press not a repeat --- src/minui/main.c | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/src/minui/main.c b/src/minui/main.c index fdb26d4..90ee850 100644 --- a/src/minui/main.c +++ b/src/minui/main.c @@ -1256,28 +1256,38 @@ int main (int argc, char *argv[]) { if (total>0) { if (PAD_justRepeated(BTN_UP)) { - selected -= 1; - if (selected<0) { - selected = total-1; - int start = total - MAIN_ROW_COUNT; - top->start = (start<0) ? 0 : start; - top->end = total; + if (selected==0 && !PAD_justPressed(BTN_UP)) { + // stop at top } - else if (selectedstart) { - top->start -= 1; - top->end -= 1; + else { + selected -= 1; + if (selected<0) { + selected = total-1; + int start = total - MAIN_ROW_COUNT; + top->start = (start<0) ? 0 : start; + top->end = total; + } + else if (selectedstart) { + top->start -= 1; + top->end -= 1; + } } } else if (PAD_justRepeated(BTN_DOWN)) { - selected += 1; - if (selected>=total) { - selected = 0; - top->start = 0; - top->end = (total=top->end) { - top->start += 1; - top->end += 1; + else { + selected += 1; + if (selected>=total) { + selected = 0; + top->start = 0; + top->end = (total=top->end) { + top->start += 1; + top->end += 1; + } } } if (PAD_justRepeated(BTN_LEFT)) {