From 4de5b596861f6e8d37633523917ab1bb0436e3d0 Mon Sep 17 00:00:00 2001 From: TheWahlolly Date: Sun, 13 Apr 2025 18:50:09 +0300 Subject: [PATCH] Whoops. Forgot to push a change. --- halyde/lib/termlib.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/halyde/lib/termlib.lua b/halyde/lib/termlib.lua index 797417c..2ca0887 100644 --- a/halyde/lib/termlib.lua +++ b/halyde/lib/termlib.lua @@ -4,7 +4,10 @@ local event = import("event") local gpu = component.proxy(component.list("gpu")()) -- replace with component.gpu once implemented local ocelot = component.proxy(component.list("ocelot")()) _G.termlib = {} -termlib.nextPosX, termlib.nextPosY = 1, 1 +termlib.nextPosX = 1 +termlib.nextPosY = 1 +termlib.cursorPosX = 1 +termlib.cursorPosY = 1 function _G.print(text) local xRes, yRes = gpu.getResolution() @@ -33,6 +36,7 @@ end function _G.read() local curtext = "" local nextPosX, nextPosY = termlib.nextPosX, termlib.nextPosY + local cursorWhite = true while true do local args = {event.pull("key_down", 0.5)} if args[4] then @@ -40,6 +44,7 @@ function _G.read() local key = keyboard.keys[keycode] if args[3] >= 32 and args[3] <= 126 then curtext = curtext .. (unicode.char(args[3]) or "") + else if key == "back" then curtext = curtext:sub(1, #curtext-1) @@ -51,6 +56,9 @@ function _G.read() end termlib.nextPosX, termlib.nextPosY = nextPosX, nextPosY print(curtext) + else + cursorWhite = not cursorWhite + end end end \ No newline at end of file