cursor when backspace fix

This commit is contained in:
MeexReay 2025-03-21 22:14:05 +03:00
parent 31762b74a2
commit f4a7b7952a

View File

@ -81,6 +81,11 @@ async function main(args) {
if (event.key == "Backspace") { if (event.key == "Backspace") {
let index = axisToIndex(content.split("\n"), pos) let index = axisToIndex(content.split("\n"), pos)
content = content.slice(0, index - 1) + content.slice(index) content = content.slice(0, index - 1) + content.slice(index)
if (pos[0] == 0 && pos[1] > 0) {
pos[1]--
} else {
pos[0]--
}
} else if (event.key == "Delete") { } else if (event.key == "Delete") {
let index = axisToIndex(content.split("\n"), pos) let index = axisToIndex(content.split("\n"), pos)
content = content.slice(0, index) + content.slice(index + 1) content = content.slice(0, index) + content.slice(index + 1)