diff --git a/sys/apis/input.lua b/sys/apis/input.lua index 661ad70..4134461 100644 --- a/sys/apis/input.lua +++ b/sys/apis/input.lua @@ -91,7 +91,7 @@ function input:translate(event, code, p1, p2) end return { code = ch } end - else + elseif code then self.state[code] = true self.fired = false end diff --git a/sys/apis/terminal.lua b/sys/apis/terminal.lua index dc10311..214e4ec 100644 --- a/sys/apis/terminal.lua +++ b/sys/apis/terminal.lua @@ -192,8 +192,11 @@ function Terminal.window(parent, sx, sy, w, h, isVisible) end function win.restoreCursor() - win.setCursorPos(cx, cy) - win.setCursorBlink(blink) + if isVisible then + win.setCursorPos(cx, cy) + win.setTextColor(fg) + win.setCursorBlink(blink) + end end function win.getPosition() diff --git a/sys/apis/ui/canvas.lua b/sys/apis/ui/canvas.lua index d980845..c7fbca3 100644 --- a/sys/apis/ui/canvas.lua +++ b/sys/apis/ui/canvas.lua @@ -63,8 +63,22 @@ function Canvas:resize(w, h) table.remove(self.lines, #self.lines) end - if w ~= self.width then - self:clear() + if w < self.width then + for i = 1, h do + self.lines[i].text = _sub(self.lines[i].text, 1, w) + self.lines[i].fg = _sub(self.lines[i].fg, 1, w) + self.lines[i].bg = _sub(self.lines[i].bg, 1, w) + end + elseif w > self.width then + local d = w - self.width + local text = _rep(' ', d) + local fg = _rep(self.palette[self.fg or colors.white], d) + local bg = _rep(self.palette[self.bg or colors.black], d) + for i = 1, h do + self.lines[i].text = self.lines[i].text .. text + self.lines[i].fg = self.lines[i].fg .. fg + self.lines[i].bg = self.lines[i].bg .. bg + end end self.ex = self.x + w - 1 diff --git a/sys/init/1.device.lua b/sys/init/1.device.lua index 3d25083..803898d 100644 --- a/sys/init/1.device.lua +++ b/sys/init/1.device.lua @@ -121,14 +121,6 @@ function keyboard.removeHotkey(code) keyboard.hotkeys[code] = nil end -kernel.hook('monitor_touch', function(event, eventData) - local monitor = Peripheral.getBySide(eventData[1]) - if monitor and monitor.eventChannel then - monitor.eventChannel(event, table.unpack(eventData)) - return true -- stop propagation - end -end) - local function createDevice(name, devType, method, manipulator) local dev = { name = name,