Skip to content

Commit

Permalink
Merge pull request #90 from PiXeL99-eng/main
Browse files Browse the repository at this point in the history
Fixed Arrow Up function bug
  • Loading branch information
TechSpiritSS authored Jan 3, 2023
2 parents ff91923 + 8dc6dc1 commit 79ae294
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,22 @@ app.addEventListener("keydown", async function (event) {
}
if (event.key === "ArrowUp") {
if (count > 0) {
await delay(0.005);
const input = document.querySelector("input");
input.value = history[--count];
const end = input.value.length;
input.setSelectionRange(end, end);
}
}
if (event.key === "ArrowDown") {
if (count < history.length - 1) {
const input = document.querySelector("input");
input.value = history[++count];
} else {

if (count === history.length - 1){
count++;
}
const input = document.querySelector("input");
input.value = "";
}
Expand Down

0 comments on commit 79ae294

Please sign in to comment.