diff --git a/assets/disk0/tvdos/bin/color.js b/assets/disk0/tvdos/bin/color.js index 766da6c..61ee144 100644 --- a/assets/disk0/tvdos/bin/color.js +++ b/assets/disk0/tvdos/bin/color.js @@ -39,5 +39,6 @@ if (exec_args[1]) { serial.println(fo) graphics.setBackground(ba[0], ba[1], ba[2]) + _G.shell.usrcfg.textCol = fo con.color_pair(fo, 255) } \ No newline at end of file diff --git a/assets/disk0/tvdos/bin/command.js b/assets/disk0/tvdos/bin/command.js index 359cffc..e47e726 100644 --- a/assets/disk0/tvdos/bin/command.js +++ b/assets/disk0/tvdos/bin/command.js @@ -108,6 +108,7 @@ function trimStartRevSlash(s) { } let shell = {}; +shell.usrcfg = {textCol: 254} shell.replaceVarCall = function(value) { // syntax: // line = literal [varcall] [literal] ; @@ -306,12 +307,8 @@ shell.coreutils = { graphics.clearPixels2(240); }, cp: function(args) { - if (args[2] === undefined) { - printerrln("Syntax error") - return - } - else if (args[1] === undefined) { - printerrln(`Usage: ${args[0].toUpperCase()} SOURCE DEST`) + if (args[2] === undefined || args[1] === undefined) { + printerrln(`Usage: ${args[0].toUpperCase()} source_file destination_file`) return } let path = shell.resolvePathInput(args[1]) @@ -367,7 +364,7 @@ shell.coreutils = { }, del: function(args) { if (args[1] === undefined) { - printerrln("Syntax error"); + printerrln(`Usage: ${args[0].toUpperCase()} file_to_delete`); return } @@ -386,7 +383,7 @@ shell.coreutils = { }, mkdir: function(args) { if (args[1] === undefined) { - printerrln("Syntax error"); + printerrln(`Usage: ${args[0].toUpperCase()} directory_name_to_create`); return } var path = shell.resolvePathInput(args[1]) @@ -718,6 +715,7 @@ if (goInteractive) { let cmdHistoryScroll = 0; // 0 for outside-of-buffer, 1 for most recent while (!cmdExit) { con.curs_set(1); + con.color_pair(shell.usrcfg.textCol,255) print_prompt_text(); var cmdbuf = ""; diff --git a/assets/disk0/tvdos/bin/less.js b/assets/disk0/tvdos/bin/less.js index 202e181..0bbac84 100644 --- a/assets/disk0/tvdos/bin/less.js +++ b/assets/disk0/tvdos/bin/less.js @@ -15,7 +15,7 @@ let buf = ""; let fileContent = undefined let key = -1; let panSize = termW >> 1; -let scrollSize = termH >> 3; +let scrollSize = (termH / 6)|0; let startAddr = -1; let paintCur = 0; @@ -106,14 +106,18 @@ while (true) { /*Q*/if (key == 113 || key == 81) break; /*R*/else if (key == 114 || key == 82) repaint(); /*up*/else if (key == con.KEY_UP) { - scroll -= scrollSize; - if (scroll < 0) scroll = 0; - repaint(); + if (lineToBytes.length >= termH) { // only allow scrolling if the text is taller than the screen + scroll -= scrollSize; + if (scroll < 0) scroll = 0; + repaint(); + } } /*down*/else if (key == con.KEY_DOWN) { - scroll += scrollSize; - if (scroll > lineToBytes.length - termH) scroll = lineToBytes.length - termH; - repaint(); + if (lineToBytes.length >= termH) { // only allow scrolling if the text is taller than the screen + scroll += scrollSize; + if (scroll > lineToBytes.length - termH) scroll = lineToBytes.length - termH; + repaint(); + } } /*left*/else if (key == con.KEY_LEFT && pan > 0) { pan -= panSize;