From d08b0c19a9901a0f9c7dc00145b3c463037b88b1 Mon Sep 17 00:00:00 2001 From: payonel Date: Sat, 2 Apr 2016 13:17:55 -0700 Subject: [PATCH 1/2] restore fix, term open, and term palette color support Moved the palette restore code to the first part of the screen restore method to keep foreground and background correct. Updating a call to term.internal.open, window is now the last parameter Update customGPU.gpu by removing temporary code for getting and setting paletter colors as term now properly handles these colors. --- wocchat/wocchat.lua | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/wocchat/wocchat.lua b/wocchat/wocchat.lua index d0fb572..6c83089 100644 --- a/wocchat/wocchat.lua +++ b/wocchat/wocchat.lua @@ -62,13 +62,13 @@ local function saveScreen() end local function restoreScreen() - term.setCursor(1,screen.height) - gpu.setBackground(table.unpack(screen.bg)) - gpu.setForeground(table.unpack(screen.fg)) print("Restoring screen ...") for i = 0,15 do gpu.setPaletteColor(i,screen.palette[i]) end + term.setCursor(1,screen.height) + gpu.setBackground(table.unpack(screen.bg)) + gpu.setForeground(table.unpack(screen.fg)) end local function loadConfig() @@ -440,11 +440,7 @@ end local customGPU={} if newterm then - -- New term does not handle palette colors properly yet, hack around this. - customGPU.gpu = { - setForeground = function(color) gpu.setForeground(color, true) end, - setBackground = function(color) gpu.setBackground(color, true) end, - } + customGPU.gpu = {} else customGPU.gpu = { set = function(x,y,s,v) return gpu.set(x+customGPU.x-1,y+customGPU.y-1,s,v ~= nil and v) end, @@ -1553,8 +1549,7 @@ if newterm then end local window = term.internal.open() - -- TODO: window will eventually be moved to the end in later updates. - term.bind(window, customGPU.gpu, term.screen(), term.keyboard()) + term.bind(customGPU.gpu, term.screen(), term.keyboard(), window) process.info().data.window = window customGPU.window = window else From af175963b4404885b3a797492aadec769d5ab212 Mon Sep 17 00:00:00 2001 From: payonel Date: Sun, 3 Apr 2016 23:33:09 -0700 Subject: [PATCH 2/2] the latest term fixes make nowrap a good solution for wocchat --- wocchat/wocchat.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/wocchat/wocchat.lua b/wocchat/wocchat.lua index 6c83089..9c9e2da 100644 --- a/wocchat/wocchat.lua +++ b/wocchat/wocchat.lua @@ -439,9 +439,7 @@ local function drawTextbar(x,y,width,text) end local customGPU={} -if newterm then - customGPU.gpu = {} -else +if not newterm then customGPU.gpu = { set = function(x,y,s,v) return gpu.set(x+customGPU.x-1,y+customGPU.y-1,s,v ~= nil and v) end, get = function(x,y) return gpu.get(x+customGPU.x-1,y+customGPU.y-1) end, @@ -1472,7 +1470,7 @@ local function main() helper.joinServer(k) end end - local history = {} + local history = {nowrap=true} while true do if dirty.blocks or dirty.title or dirty.window or dirty.nicks then redraw()