From 52fb3674dc51be83000e3e6a7cf6972b0904917e Mon Sep 17 00:00:00 2001 From: Brenden Tuck Date: Thu, 4 Oct 2018 19:59:30 -0400 Subject: [PATCH] Fix #1668 - up arrow key regression --- .../static/webclient/js/plugins/history.js | 30 ++++--------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/evennia/web/webclient/static/webclient/js/plugins/history.js b/evennia/web/webclient/static/webclient/js/plugins/history.js index 1bef6031cd..c33dbcabf9 100644 --- a/evennia/web/webclient/static/webclient/js/plugins/history.js +++ b/evennia/web/webclient/static/webclient/js/plugins/history.js @@ -43,14 +43,6 @@ let history_plugin = (function () { history_pos = 0; } - // - // Go to the last history line - var end = function () { - // move to the end of the history stack - history_pos = 0; - return history[history.length -1]; - } - // // Add input to the scratch line var scratch = function (input) { @@ -69,28 +61,17 @@ let history_plugin = (function () { var history_entry = null; var inputfield = $("#inputfield"); - if (inputfield[0].selectionStart == inputfield.val().length) { - // Only process up/down arrow if cursor is at the end of the line. - if (code === 38) { // Arrow up - history_entry = back(); - } - else if (code === 40) { // Arrow down - history_entry = fwd(); - } + if (code === 38) { // Arrow up + history_entry = back(); + } + else if (code === 40) { // Arrow down + history_entry = fwd(); } if (history_entry !== null) { // Doing a history navigation; replace the text in the input. inputfield.val(history_entry); } - else { - // Save the current contents of the input to the history scratch area. - setTimeout(function () { - // Need to wait until after the key-up to capture the value. - scratch(inputfield.val()); - end(); - }, 0); - } return false; } @@ -99,6 +80,7 @@ let history_plugin = (function () { // Listen for onSend lines to add to history var onSend = function (line) { add(line); + return null; // we are not returning an altered input line } //