From c3cc6f4d1a96f86bfc886516268e364f174697fe Mon Sep 17 00:00:00 2001 From: minjaesong Date: Fri, 13 Nov 2020 21:15:53 +0900 Subject: [PATCH] fixing LESS not displaying full text --- assets/tvdos/bin/less.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/tvdos/bin/less.js b/assets/tvdos/bin/less.js index 2690ac6..c74d8da 100644 --- a/assets/tvdos/bin/less.js +++ b/assets/tvdos/bin/less.js @@ -24,7 +24,6 @@ if (!fileOpened) { let scroll = 0; let termW = con.getmaxyx()[1]; let termH = con.getmaxyx()[0] - 1; -let bufsize = termW * termH; let buf = ""; let fileContent = filesystem.readAll(_G.shell.getCurrentDrive()); let key = -1; @@ -51,8 +50,9 @@ let repaint = function() { startAddr = lineToBytes[scroll]; cy = 1; cx = 1; paintCur = 0; - while (cy <= termH && cx <= termW) { + while (cy <= termH) { char = fileContent.charCodeAt(startAddr + paintCur); + if (isNaN(char)) break; if (cy <= termH) { con.move(cy, cx); if (char != 10 && char != 13) @@ -80,11 +80,11 @@ while (true) { scroll -= 1; repaint(); } - /*down*/else if (key == 20 && scroll < lineToBytes.length - 1) { + /*down*/else if (key == 20 && scroll < lineToBytes.length - termH) { scroll += 1; repaint(); } } con.move(termH + 1, 1); -return 0; +return 0; \ No newline at end of file