From 275cab938ba35acaf7da51969a5e4fbda9ffa346 Mon Sep 17 00:00:00 2001
From: Eric Oulashin <eric.oulashin@gmail.com>
Date: Mon, 7 Feb 2022 13:21:57 -0800
Subject: [PATCH] Fix for left/right navigation for command bar introduced in
 last commit

---
 xtrn/ddfilelister/ddfilelister.js | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/xtrn/ddfilelister/ddfilelister.js b/xtrn/ddfilelister/ddfilelister.js
index 2c2821d3c3..66ce05d767 100644
--- a/xtrn/ddfilelister/ddfilelister.js
+++ b/xtrn/ddfilelister/ddfilelister.js
@@ -1192,19 +1192,21 @@ function DDFileMenuBar_getDDFileMenuBarItemText(pText, pSelected, pWithTrailingB
 // menu bar on the screen
 function DDFileMenuBar_incrementMenuItemAndRefresh()
 {
-	++this.currentCommandIdx;
-	if (this.currentCommandIdx >= this.cmdArray.length)
-		this.currentCommandIdx = 0;
-	this.refreshWithNewAction(this.currentCommandIdx);
+	var newCmdIdx = this.currentCommandIdx + 1;
+	if (newCmdIdx >= this.cmdArray.length)
+		newCmdIdx = 0;
+	// Will set this.currentCommandIdx
+	this.refreshWithNewAction(newCmdIdx);
 }
 // For the DDFileMenuBar class: Decrements to the previous menu item and refreshes the
 // menu bar on the screen
 function DDFileMenuBar_decrementMenuItemAndRefresh()
 {
-	--this.currentCommandIdx;
-	if (this.currentCommandIdx < 0)
-		this.currentCommandIdx = this.cmdArray.length - 1;
-	this.refreshWithNewAction(this.currentCommandIdx);
+	var newCmdIdx = this.currentCommandIdx - 1;
+	if (newCmdIdx < 0)
+		newCmdIdx = this.cmdArray.length - 1;
+	// Will set this.currentCommandIdx
+	this.refreshWithNewAction(newCmdIdx);
 }
 // For the DDFileMenuBar class: Gets the return code for the currently selected action
 function DDFileMenuBar_getCurrentSelectedAction()
-- 
GitLab