--:Minify:-- syscall.TTY_clear() syscall.TTY_setTextColor(1) syscall.TTY_setCursorPos(1, 1) print("HyperionOS Bash Shell") print("") local preCommandText = "example@testPrompt:~$ " while true do local command = "" local cursorPos = 1 local typingCmd = true while typingCmd do local event = syscall.IO_getEventAny() if event then if event[1] == "keyTyped" then if event[3] == "\n" then --Enter print("") typingCmd = false elseif event[3] == "\b" then --Backspace if cursorPos > 1 then cursorPos = cursorPos - 1 command = command:sub(1, cursorPos - 1)..command:sub(cursorPos + 1) end elseif event[3]:sub(1, 1) == "\x1b" then --Escape Sequence elseif event[3] ~= "\t" and #event[3] == 1 then --Standard Character command = command:sub(1, cursorPos - 1)..event[3]..command:sub(cursorPos + 1) cursorPos = cursorPos + 1 end end end local _, cursorY = syscall.TTY_getCursorPos() syscall.TTY_setCursorPos(1, cursorY) printInline(preCommandText..command.." ") syscall.TTY_setCursorPos(#preCommandText + cursorPos, cursorY) end end