From ed70d65268b7c4d8479de55f03e782fb36f6ea59 Mon Sep 17 00:00:00 2001
From: Eric Oulashin <nightfox@synchro.net>
Date: Mon, 9 Jan 2023 23:14:07 +0000
Subject: [PATCH] DD lightbar menu fix for navigating with the HOME key with
 the top item index > 0 & selected item is in the middle of the screen

---
 exec/load/dd_lightbar_menu.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/exec/load/dd_lightbar_menu.js b/exec/load/dd_lightbar_menu.js
index 4b9302558e..6340cb4a62 100644
--- a/exec/load/dd_lightbar_menu.js
+++ b/exec/load/dd_lightbar_menu.js
@@ -1725,12 +1725,13 @@ function DDLightbarMenu_GetVal(pDraw, pSelectedItemIndexes)
 			if (this.selectedItemIdx > 0)
 			{
 				var oldSelectedItemIdx = this.selectedItemIdx;
+				this.oldTopItemIdx = this.topItemIdx;
 				// If the current item index is not on first current page, then scroll.
 				// Otherwise, draw more efficiently by drawing the current item in
 				// regular colors and the first item in highlighted colors.
 				this.topItemIdx = 0;
 				var numItemsPerPage = this.GetNumItemsPerPage();
-				if (this.selectedItemIdx >= 0 + numItemsPerPage)
+				if (this.oldTopItemIdx > 0)
 				{
 					this.selectedItemIdx = 0;
 					this.Draw(pSelectedItemIndexes, false);
-- 
GitLab