From 8be66e5c2a0870dadab247c8d6f3eec8518f119a Mon Sep 17 00:00:00 2001
From: Arkerthan <arkerthan@gmail.com>
Date: Thu, 4 Jun 2020 14:22:49 +0200
Subject: [PATCH] add dynamic hotkey display for return link

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

diff --git a/src/gui/quicklinks.js b/src/gui/quicklinks.js
index 44d689b915c..249817e1f50 100644
--- a/src/gui/quicklinks.js
+++ b/src/gui/quicklinks.js
@@ -17,7 +17,7 @@ App.UI.quickMenu = (function() {
 	const noHistory = Story.lookup("tags", "no-history").map(passage => passage.title);
 
 	// if property name is a passage name, then it's a link, otherwise only text.
-	// category titles  are never links to passages
+	// category titles are never links to passages
 	// Only two values are allowed: true or an object following the same rules
 	const layout = addOtherCategory({
 		Main: true,
@@ -284,7 +284,7 @@ App.UI.quickMenu = (function() {
 			history.shift();
 		}
 	});
-	App.UI.Hotkeys.add("Back in history", {callback: goBack, combinations: ["backspace"]});
+	App.UI.Hotkeys.add("historyBack", {callback: goBack, combinations: ["backspace"], uiName: "Back in history"});
 
 	/**
 	 * Goes back in history if possible.
@@ -307,7 +307,10 @@ App.UI.quickMenu = (function() {
 			const a = document.createElement("a");
 			a.append("Return");
 			a.onclick = goBack;
-			div.append(a, " ", App.UI.DOM.makeElement("span", "[backspace]", "hotkey"));
+			const hotkey = App.UI.Hotkeys.hotkeys("historyBack");
+			if (hotkey !== "") {
+				div.append(a, " ", App.UI.DOM.makeElement("span", hotkey, "hotkey"));
+			}
 			// insert at second position
 			linkList.splice(1, 0, div);
 		}
-- 
GitLab