From 823ca55496c2f52edab349068e51642260e65e5f Mon Sep 17 00:00:00 2001 From: minjaesong Date: Wed, 21 Apr 2021 17:47:51 +0900 Subject: [PATCH] edit.js: hor scroll also works; what left is doing vert scroll when col > 0 --- assets/disk0/tvdos/bin/edit.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/assets/disk0/tvdos/bin/edit.js b/assets/disk0/tvdos/bin/edit.js index d192a65..1a631f5 100644 --- a/assets/disk0/tvdos/bin/edit.js +++ b/assets/disk0/tvdos/bin/edit.js @@ -43,11 +43,11 @@ if (editingExistingFile) { textbuffer = filesystem.readAll(driveLetter).split("\n"); } -let windowWidth = con.getmaxyx()[1]; -let windowHeight = con.getmaxyx()[0]; -let paintWidth = windowWidth - PAINT_START_X + 1; -let paintHeight = windowHeight - PAINT_START_Y + 1; -let scrollPeek = Math.ceil((paintHeight / 7)); +let windowWidth = 0; +let windowHeight = 0; +let paintWidth = 0; +let paintHeight = 0; +let scrollPeek = 0; function drawInit() { windowWidth = con.getmaxyx()[1]; windowHeight = con.getmaxyx()[0]; @@ -300,7 +300,7 @@ function cursorMoveRelative(odx, ody) { // set new dx if destination col is outside of the line if (cursorCol + dx > textbuffer[cursorRow + dy].length) - dx -= (cursorCol + dx) - textbuffer[cursorRow].length + 1 + dx = textbuffer[cursorRow].length - cursorCol; else if (cursorCol + dx < 0) dx = -cursorCol; @@ -352,7 +352,7 @@ function cursorMoveRelative(odx, ody) { drawTextbuffer(); drawLineNumbers(); } else if (oldScrollHor != scrollHor) { - drawTextLine(ny); + drawTextLine(cursorRow - scroll); } // remove old caret highlights if (dy != 0 && COL_CARET_ROW !== undefined) {