diff --git a/src/c/epoll.c b/src/c/epoll.c index 34c63db..bc54153 100644 --- a/src/c/epoll.c +++ b/src/c/epoll.c @@ -12,12 +12,12 @@ static int handleStdin(int fd, void* data) { char buf; int r = read(fd, &buf, 1); //TODO: Wide chars? if(r > 0) { - if(buf == 10) buf = 13; + //if(buf == 10) buf = 13; lua_State* L = getL(); lua_getglobal(L, "pushEvent"); lua_pushstring(L, "key_down"); - lua_pushstring(L, "TODO:SetThisUuid"); + lua_pushstring(L, "TODO:SetThisUuid");//Also in textgpu.lua lua_pushnumber(L, buf); lua_pushnumber(L, -1); lua_pushstring(L, "user"); diff --git a/src/c/termutils.c b/src/c/termutils.c index e29c4a2..1a04347 100644 --- a/src/c/termutils.c +++ b/src/c/termutils.c @@ -31,10 +31,13 @@ void termutils_start(lua_State *L) { struct termios old, new; if (tcgetattr (STDOUT_FILENO, &old) != 0) return; - new = old; - new.c_lflag &= ~ECHO; - if (tcsetattr (STDOUT_FILENO, TCSAFLUSH, &new) != 0) - return; + new = old; + + cfmakeraw(&new); + + + if (tcsetattr (STDOUT_FILENO, TCSAFLUSH, &new) != 0) + return; lua_createtable (L, 0, 1); pushctuple(L, "getSize", l_get_term_sz); diff --git a/src/lua/core/component.lua b/src/lua/core/component.lua index a8590e2..7057c21 100644 --- a/src/lua/core/component.lua +++ b/src/lua/core/component.lua @@ -28,7 +28,6 @@ function api.register(address, ctype, proxy, doc) components[address].proxy = {} for k,v in pairs(proxy) do if type(v) == "function" then - print("Cfunc " .. k) components[address].proxy[k] = setmetatable({name=k,address=address}, componentCallback) else components[address].proxy[k] = v diff --git a/src/lua/core/computer.lua b/src/lua/core/computer.lua index e05d195..5f52581 100644 --- a/src/lua/core/computer.lua +++ b/src/lua/core/computer.lua @@ -87,22 +87,28 @@ local keymap = { [0x60 + 0x1B] = 0x15, [0x60 + 0x1C] = 0x2C, - [13] = 28, + [13] = 28, --Return key + [127] = 14, --backspace + [9] = 15, --Tab } +local asciitr = { + [127] = 8, +} + function computer.signalTransformers.key_down(s, a, ascii, key, user) if key ~= -1 then return s, a, ascii, key, user end - return s, a, ascii, keymap[ascii] or key, user + return s, a, asciitr[ascii] or ascii, keymap[ascii] or key, user end function computer.signalTransformers.key_up(s, a, ascii, key, user) if key ~= -1 then return s, a, ascii, key, user end - return s, a, ascii, keymap[ascii] or key, user + return s, a, asciitr[ascii] or ascii, keymap[ascii] or key, user end ----- diff --git a/src/lua/core/textgpu.lua b/src/lua/core/textgpu.lua index 84dcecc..0751cb2 100644 --- a/src/lua/core/textgpu.lua +++ b/src/lua/core/textgpu.lua @@ -51,7 +51,7 @@ function textgpu.start() if isPaletteIndex then return --TODO: Maybe? end - local old = foreground + local old = background background = tostring(math.floor(modules.color.nearest(color, mapping))) io.write("\x1b[4" .. background .. "m") io.flush() @@ -219,7 +219,7 @@ function textgpu.start() gpu.setBackground(0x000000) modules.component.api.register(nil, "gpu", gpu) - modules.component.api.register(nil, "screen", {getKeyboards = function() return {} end}) --verry dummy screen, TODO: make it better + modules.component.api.register(nil, "screen", {getKeyboards = function() return {"TODO:SetThisUuid"} end}) --verry dummy screen, TODO: make it better, kbd uuid also in epoll.c deadhooks[#deadhooks + 1] = function() io.write("\x1b[?25h") --Enable cursor on quit