diff --git a/apps/Peripherals.lua b/apps/Peripherals.lua index 9dbf6a3..1ab841f 100644 --- a/apps/Peripherals.lua +++ b/apps/Peripherals.lua @@ -128,10 +128,6 @@ function methodsPage:enable(p) self:setFocus(self.grid) end -function methodsPage.doc:focus() - -- allow keyboard scrolling -end - function methodsPage:eventHandler(event) if event.type == 'back' then UI:setPage(peripheralsPage) diff --git a/apps/Turtles.lua b/apps/Turtles.lua index 9cfa5a9..13945e9 100644 --- a/apps/Turtles.lua +++ b/apps/Turtles.lua @@ -125,7 +125,8 @@ local page = UI.Page { fn = 'turtle.turnRight', }, info = UI.TextArea { - x = 2, y = 9 + x = 2, y = 9, + inactive = true, } }, }, @@ -379,7 +380,7 @@ local lookup = { } if lookup[options.tab.value] then - page.tabs:activateTab(lookup[options.tab.value]) + page.tabs:activateTab(lookup[options.tab.value].uid) end UI:pullEvents() diff --git a/apps/logMonitor.lua b/apps/logMonitor.lua index d54c2b1..df98c46 100644 --- a/apps/logMonitor.lua +++ b/apps/logMonitor.lua @@ -36,6 +36,31 @@ elseif device.monitor then }) end +--[[-- ScrollingText --]]-- +UI.ScrollingText = class(UI.Window) +UI.ScrollingText.defaults = { + UIElement = 'ScrollingText', + backgroundColor = colors.black, + buffer = { }, +} +function UI.ScrollingText:appendLine(text) + if #self.buffer+1 >= self.height then + table.remove(self.buffer, 1) + end + table.insert(self.buffer, text) +end + +function UI.ScrollingText:clear() + self.buffer = { } + UI.Window.clear(self) +end + +function UI.ScrollingText:draw() + for k,text in ipairs(self.buffer) do + self:write(1, k, Util.widthify(text, self.width), self.backgroundColor) + end +end + terminal:clear() function getClient(id) diff --git a/apps/simpleMiner.lua b/apps/simpleMiner.lua index f953d28..3116daf 100644 --- a/apps/simpleMiner.lua +++ b/apps/simpleMiner.lua @@ -291,7 +291,7 @@ function normalChestUnload() makeWalkableTunnel(action, tpt, { x = pt.x, z = pt.z }) end) - safeGoto(0, 0) + safeGoto(0, 0, 0) if not turtle.detectUp() then error('no chest') end