Add sheet viewer page

This commit is contained in:
dylan
2023-05-06 14:49:46 -07:00
parent 0adfdabffa
commit 471fa9e0b6
11 changed files with 269 additions and 56 deletions

View File

@ -2,15 +2,16 @@ import { clearScreen, fillRect } from "./window.ts";
import { fontWidth, fontHeight } from "./font.ts";
import { drawText } from "./builtins.ts";
import { COLOR } from "./colors.ts";
import {getCodeSheet, setSheet} from "./sheet.ts";
import { getCodeSheet, setSheet } from "./sheet.ts";
import { K, ctrlKeyDown, getKeyboardString, keyPressed, shiftKeyDown } from "./keyboard.ts";
import { clipboard, tokenize } from "./deps.ts";
import { getContext } from "./runcode.ts";
import { page } from "./viewsheets.ts";
const historyDebounceFrames = 20;
const state = {
history: [{code: getCodeSheet(0), anchor: 0, focus: 0}],
history: [{code: getCodeSheet(page.activeSheet), anchor: 0, focus: 0}],
historyDebounce: 0,
historyIndex: 0,
undo() {
@ -201,10 +202,10 @@ const state = {
return match[0];
},
get code() {
return getCodeSheet(0);
return getCodeSheet(page.activeSheet);
},
set code(val) {
setSheet(0, "code", val);
setSheet(page.activeSheet, "code", val);
}
}