From ee89d2e6f59458429a8b0aced96e38e433a8c737 Mon Sep 17 00:00:00 2001 From: AJ Fontaine Date: Sat, 21 Sep 2024 16:48:40 -0400 Subject: [PATCH] Make Egg summary UI cursor wrap --- src/ui/egg-summary-ui-handler.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ui/egg-summary-ui-handler.ts b/src/ui/egg-summary-ui-handler.ts index 99fbccb4257..82f237a7e08 100644 --- a/src/ui/egg-summary-ui-handler.ts +++ b/src/ui/egg-summary-ui-handler.ts @@ -273,21 +273,29 @@ export default class EggSummaryUiHandler extends MessageUiHandler { case Button.UP: if (row) { success = this.setCursor(this.cursor - numCols); + } else if (rows > 1) { + success = this.setCursor((rows-1) * numCols + this.cursor < count ? (rows-1) * numCols + this.cursor : (rows-2) * numCols + this.cursor); } break; case Button.DOWN: if (row < rows - 2 || (row < rows - 1 && this.cursor % numCols <= (count - 1) % numCols)) { success = this.setCursor(this.cursor + numCols); + } else { + this.setCursor(this.cursor % numCols); } break; case Button.LEFT: - if (this.cursor % numCols) { + if (this.cursor === 0) { + success = this.setCursor(count - 1); + } else { success = this.setCursor(this.cursor - 1); } break; case Button.RIGHT: - if (this.cursor % numCols < (row < rows - 1 ? 10 : (count - 1) % numCols)) { + if (this.cursor < count - 1) { success = this.setCursor(this.cursor + 1); + } else { + success = this.setCursor(0); } break; }