From e75632977e63fdd94ee06e1c70fbaf0c8522dc55 Mon Sep 17 00:00:00 2001
From: Arkerthan <arkerthan@gmail.com>
Date: Mon, 18 May 2020 10:34:15 +0200
Subject: [PATCH] fix history not recording initial passage

---
 src/gui/quicklinks.js | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/gui/quicklinks.js b/src/gui/quicklinks.js
index 610df61948f..cea5904c230 100644
--- a/src/gui/quicklinks.js
+++ b/src/gui/quicklinks.js
@@ -61,18 +61,17 @@ App.UI.quickMenu = (function() {
 
 	// setup history
 	let history = [];
-	let currentPassage;
 	let historyNavigation = false;
 	$(document).on(':passageinit', event => {
 		// if navigated here normally, add passage to history, otherwise remove last entry from history
 		if (!historyNavigation) {
-			if (currentPassage === event.passage.title) {
+			if (State.passage === event.passage.title) {
 				// only reloaded passage
 				return;
 			}
 			// if last passage can be jumped to add passage to history, otherwise clear history
-			if (jumpTo.includes(currentPassage)) {
-				history.push(currentPassage);
+			if (jumpTo.includes(State.passage)) {
+				history.unshift(State.passage);
 			} else {
 				history = [];
 			}
@@ -80,7 +79,6 @@ App.UI.quickMenu = (function() {
 			historyNavigation = false;
 			history.shift();
 		}
-		currentPassage = event.passage.title;
 	});
 	Mousetrap.bind("backspace", () => {
 		// jump back in history
-- 
GitLab