diff --git a/cat.yarn b/cat.yarn index 277e8be..3142329 100644 --- a/cat.yarn +++ b/cat.yarn @@ -1 +1 @@ -{"protected":false,"mode":"f","metadata":{"name":"cat","author":"Luna Magdalena :3","version":[1],"dependencies":[],"paths":{"cat.js":"%B/cat.js"}},"content":"{\"cat.js\":{\"protected\":true,\"metadata\":{\"runner\":[]},\"mode\":\"f\",\"content\":\"program.autoOutput = false\\n\\nfor (let a of args) {\\n let file\\n try {\\n file = io.open(a)\\n } catch (e) {\\n display.print(\\\"Cannot open file\\\", 0x9000)\\n }\\n if (file) {\\n const lines = file.lines()\\n for (let line of lines) {\\n io.output(\\\"%n\\\" + line)\\n display.print(line, itty.baseStyle, false)\\n }\\n }\\n}\\n \\nquit()\"}}"} \ No newline at end of file +{"protected":false,"mode":"f","metadata":{"name":"cat","author":"Luna Magdalena :3","version":[1,1],"dependencies":[],"paths":{"cat.js":"%B/cat.js"}},"content":"{\"cat.js\":{\"protected\":true,\"metadata\":{\"runner\":[]},\"mode\":\"f\",\"content\":\"program.autoOutput = false\\n\\nfor (let a of args) {\\n let file\\n try {\\n file = io.open(a)\\n } catch (e) {\\n display.print(\\\"Cannot open file\\\", 0x9000)\\n }\\n if (file) {\\n const lines = file.lines()\\n for (let line of lines) {\\n line = line.replace(/%/g, \\\"%%\\\")\\n io.output(\\\"\\\\n\\\" + line)\\n display.print(line, itty.baseStyle, false)\\n }\\n }\\n}\\n \\nquit()\"}}"} \ No newline at end of file diff --git a/repo.json b/repo.json index 7b6eeca..8fd852e 100644 --- a/repo.json +++ b/repo.json @@ -1,7 +1,7 @@ { "name": "itty", "packages": { - "cat": {"url": "~cat.yarn", "version": [1]}, + "cat": {"url": "~cat.yarn", "version": [1, 1]}, "clear": {"url": "~clear.yarn", "version": [1]}, "cp": {"url": "~cp.yarn", "version": [1]}, "echo": {"url": "~echo.yarn", "version": [1]}, @@ -21,6 +21,7 @@ "yarn": {"url": "~yarn.yarn", "version": [1]}, "plist": {"url": "~plist.yarn", "version": [1]}, "kill": {"url": "~kill.yarn", "version": [1]}, - "bg": {"url": "~bg.yarn", "version": [1]} + "bg": {"url": "~bg.yarn", "version": [1]}, + "scroll": {"scroll": "~scroll.yarn", "version": [1]} } } diff --git a/scroll.yarn b/scroll.yarn new file mode 100644 index 0000000..7ad6191 --- /dev/null +++ b/scroll.yarn @@ -0,0 +1 @@ +{"protected":false,"mode":"f","metadata":{"name":"scroll","author":"Luna Magdalena :3","version":[1],"dependencies":[],"paths":{"scroll.js":"%B/scroll.js"}},"content":"{\"scroll.js\":{\"protected\":true,\"metadata\":{\"runner\":[]},\"mode\":\"f\",\"content\":\"if (!pipe)\\n quit()\\n\\nprogram.enterFullscreen()\\n\\nconst lines = pipe.split(\\\"\\\\n\\\")\\n\\nfunction renderLines() {\\n display.clear()\\n for (let i = start; i < lines.length; i++) {\\n if (lines[i].length / itty.width > itty.height - itty.cursorY) {\\n for (let x = 0; x < Math.floor(lines[i].length / itty.width); x++)\\n display.lift()\\n break\\n }\\n display.print(lines[i] || \\\" \\\", undefined, false)\\n }\\n}\\n\\nlet start = 0\\nrenderLines()\\n\\nfunction onInput(k) {\\n switch (k) {\\n case \\\"%^\\\":\\n start = Math.max(start - 1, 0)\\n renderLines()\\n break\\n case \\\"%v\\\":\\n start = Math.min(start + 1, lines.length - 1)\\n renderLines()\\n break\\n case \\\"%e\\\":\\n case \\\"q\\\":\\n quit()\\n }\\n}\\n\\nfunction onQuit() {\\n display.clear()\\n}\"}}"} \ No newline at end of file