edit.js: home/end to move text cursor

This commit is contained in:
minjaesong
2021-04-16 17:31:36 +09:00
parent 74020199a6
commit 1fc01ab745

View File

@@ -331,6 +331,12 @@ while (!exit) {
else if (key == con.KEY_RIGHT && cursorCol < textbuffer[cursorRow].length) {
nextCol(); drawLnCol(); gotoText();
}
else if (key == con.KEY_HOME) {
cursorCol = 0; scrollHor = 0; drawTextLine(cursorRow - scroll); drawLnCol(); gotoText();
}
else if (key == con.KEY_END) {
cursorCol = textbuffer[cursorRow].length; scrollHor = textbuffer[cursorRow].length - paintWidth + 2; drawTextLine(cursorRow - scroll); drawLnCol(); gotoText();
}
else if (key >= 32 && key < 128) { // printables (excludes \n)
appendText(key);
}