edit.js: highlighter position fixed when scroll > 0

This commit is contained in:
minjaesong
2021-04-21 20:02:47 +09:00
parent 823ca55496
commit 1ce7ebeac9

View File

@@ -356,8 +356,8 @@ function cursorMoveRelative(odx, ody) {
} }
// remove old caret highlights // remove old caret highlights
if (dy != 0 && COL_CARET_ROW !== undefined) { if (dy != 0 && COL_CARET_ROW !== undefined) {
drawTextLine(cursorRow - dy); drawTextLine(cursorRow - scroll - dy);
drawTextLine(cursorRow); drawTextLine(cursorRow - scroll);
} }
drawLnCol(); gotoText(); drawLnCol(); gotoText();
@@ -417,10 +417,10 @@ while (!exit) {
cursorMoveRelative(-BIG_STRIDE,1); cursorMoveRelative(-BIG_STRIDE,1);
} }
else if (key == con.KEY_PAGE_UP) { else if (key == con.KEY_PAGE_UP) {
cursorMoveRelative(0, -paintHeight + 1); cursorMoveRelative(0, -paintHeight + scrollPeek);
} }
else if (key == con.KEY_PAGE_DOWN) { else if (key == con.KEY_PAGE_DOWN) {
cursorMoveRelative(0, paintHeight - 1); cursorMoveRelative(0, paintHeight - scrollPeek);
} }
else if (key == con.KEY_HOME) { else if (key == con.KEY_HOME) {
cursorMoveRelative(-BIG_STRIDE, 0); cursorMoveRelative(-BIG_STRIDE, 0);