From f4a7b7952aa36badee25d0475e7b79e026da71b3 Mon Sep 17 00:00:00 2001 From: MeexReay Date: Fri, 21 Mar 2025 22:14:05 +0300 Subject: [PATCH] cursor when backspace fix --- app/kfc/kfc.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/kfc/kfc.js b/app/kfc/kfc.js index caa9bb9..0c54067 100644 --- a/app/kfc/kfc.js +++ b/app/kfc/kfc.js @@ -81,6 +81,11 @@ async function main(args) { if (event.key == "Backspace") { let index = axisToIndex(content.split("\n"), pos) 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") { let index = axisToIndex(content.split("\n"), pos) content = content.slice(0, index) + content.slice(index + 1)