Commit 8c8883f2 authored by Harlan Lieberman-Berg's avatar Harlan Lieberman-Berg

Fix incomplete input hanging in history.

parent 3e1e22cb
......@@ -24,6 +24,7 @@ window.webmu = (function() {
var timer;
var history = [];
var historyPos = 0;
var dirtyHistory;
function init() {
var proto = identify_protocol();
......@@ -115,11 +116,12 @@ window.webmu = (function() {
send_pose(inputbox.value);
history.push(inputbox.value);
historyPos = history.length;
dirtyHistory = undefined;
inputbox.value = '';
break;
case "ArrowUp":
if (inputbox.value.trim() && historyPos == history.length) {
history.push(inputbox.value);
dirtyHistory = inputbox.value;
}
if (historyPos > 0) {
inputbox.value = history[historyPos - 1];
......@@ -129,7 +131,7 @@ window.webmu = (function() {
case "ArrowDown":
if (historyPos < history.length) {
historyPos++;
inputbox.value = history[historyPos] || "";
inputbox.value = history[historyPos] || dirtyHistory || "";
}
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment