diff --git a/lovebird.lua b/lovebird.lua index aa6eac6..6e65866 100644 --- a/lovebird.lua +++ b/lovebird.lua @@ -160,8 +160,8 @@ end
+ onkeydown="return onInputKeyDown(event);" + onsubmit="onInputSubmit(); return false;">
@@ -223,17 +223,19 @@ end inputHistory.index = 0; var onInputKeyDown = function(e) { var key = e.which || e.keyCode; + if (key != 38 && key != 40) return true; var b = document.getElementById("inputbox"); if (key == 38 && inputHistory.index < inputHistory.length - 1) { /* Up key */ inputHistory.index++; - b.value = inputHistory[inputHistory.index]; } if (key == 40 && inputHistory.index >= 0) { /* Down key */ inputHistory.index--; - b.value = inputHistory[inputHistory.index] || ""; } + b.value = inputHistory[inputHistory.index] || ""; + b.selectionStart = b.value.length; + return false; } /* Output buffer and status */