fix remove lines 3 time

This commit is contained in:
MeexReay 2025-03-21 22:20:19 +03:00
parent d2db0ee2e7
commit fd45ace05d

View File

@ -79,6 +79,9 @@ async function main(args) {
if (event.type == "key") { if (event.type == "key") {
if (event.key == "Backspace") { if (event.key == "Backspace") {
if (pos[0] == 0 && pos[1] == 0) {
continue
}
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) { if (pos[0] > 0) {
@ -86,6 +89,7 @@ async function main(args) {
} else { } else {
if (pos[1] > 0) { if (pos[1] > 0) {
pos[1]-- pos[1]--
pos[0] = content.split("\n")[pos[1]].length
} }
} }
} else if (event.key == "Delete") { } else if (event.key == "Delete") {