Add lowercase

This commit is contained in:
dylan
2023-05-03 21:29:11 -07:00
parent ce7da27cc3
commit dca54e76ec
2 changed files with 336 additions and 125 deletions

13
repl.ts
View File

@ -2,6 +2,7 @@ import faux from "./builtins.ts";
import { getKeysPressed, shiftKeyDown, shiftMap, K } from "./keyboard.ts";
import { font } from "./font.ts";
import { runCode } from "./runcode.ts";
import { clearScreen } from "./window.ts";
const lineHeight = 6;
@ -75,7 +76,7 @@ const update = () => {
textLinesAbove.push(...resultString.split("\n"))
}
} catch (err) {
textLinesAbove.push(...(err.name+":\n"+err.message).toLowerCase().split("\n"))
textLinesAbove.push(...(err.name+":\n"+err.message).split("\n"))
}
textLinesAbove = textLinesAbove.slice(-20);
maxLineLen = 0;
@ -88,17 +89,19 @@ const update = () => {
const drawTextAbove = () => {
textLinesAbove.forEach((line, i) => {
faux.draw_rect(0, i*lineHeight, 4*(line.length+1)+1, lineHeight+1, 6);
faux.draw_text(-1, i*lineHeight, line);
faux.draw_rect(0, 1+i*lineHeight, 4*(line.length+1)+1, lineHeight+1, 0);
faux.draw_text(-1, 1+i*lineHeight, line);
});
}
const draw = () => {
clearScreen();
drawTextAbove();
faux.draw_rect(0, textLinesAbove.length*lineHeight, 4*(2+maxLineLen+1)+1, lineHeight+1, 6);
faux.draw_rect(0, 1+textLinesAbove.length*lineHeight, 4*(2+maxLineLen+1)+1, lineHeight+1, 0);
faux.draw_rect((2+index)*4, textLinesAbove.length*lineHeight+1, 4, lineHeight-1, 3);
faux.draw_text(-1, textLinesAbove.length*lineHeight, "> "+currentLine);
faux.draw_text(-1, 1+textLinesAbove.length*lineHeight, "> "+currentLine);
}
export const repl = {