fix cursor up down x pos

This commit is contained in:
MeexReay 2025-03-21 21:56:20 +03:00
parent 667e68626c
commit 0e9f074814

View File

@ -69,8 +69,10 @@ async function main(args) {
} else if (event.key == "ArrowUp") {
pos[1] = Math.max(0, pos[1] - 1)
pos[0] = Math.min(content.split("\n")[pos[1]].length, pos[0])
} else if (event.key == "ArrowDown") {
pos[1] = Math.min(content.split("\n").length-1, pos[1] + 1)
pos[0] = Math.min(content.split("\n")[pos[1]].length, pos[0])
} else if (event.key == "ArrowLeft") {
pos[0] = Math.max(0, pos[0] - 1)
} else if (event.key == "ArrowRight") {