shell cleanup

This commit is contained in:
kepler155c@gmail.com 2020-06-13 12:18:04 -06:00
parent 947f502c6d
commit b69dcdeffa
5 changed files with 164 additions and 217 deletions

View File

@ -1,4 +1,5 @@
local Ansi = require('opus.ansi') local Ansi = require('opus.ansi')
local Config = require('opus.config')
local Packages = require('opus.packages') local Packages = require('opus.packages')
local UI = require('opus.ui') local UI = require('opus.ui')
local Util = require('opus.util') local Util = require('opus.util')
@ -8,9 +9,11 @@ local term = _G.term
UI:configure('PackageManager', ...) UI:configure('PackageManager', ...)
local config = Config.load('package')
local page = UI.Page { local page = UI.Page {
grid = UI.ScrollingGrid { grid = UI.ScrollingGrid {
x = 2, ex = 14, y = 2, ey = -5, x = 2, ex = 14, y = 2, ey = -6,
values = { }, values = { },
columns = { columns = {
{ heading = 'Package', key = 'name' }, { heading = 'Package', key = 'name' },
@ -21,13 +24,13 @@ local page = UI.Page {
}, },
add = UI.Button { add = UI.Button {
x = 2, y = -3, x = 2, y = -3,
text = 'Install', text = ' + ',
event = 'action', event = 'action',
help = 'Install or update', help = 'Install or update',
}, },
remove = UI.Button { remove = UI.Button {
x = 12, y = -3, x = 8, y = -3,
text = 'Remove ', text = ' - ',
event = 'action', event = 'action',
operation = 'uninstall', operation = 'uninstall',
operationText = 'Remove', operationText = 'Remove',
@ -43,6 +46,14 @@ local page = UI.Page {
x = 16, y = 3, ey = -5, x = 16, y = 3, ey = -5,
marginRight = 2, marginLeft = 0, marginRight = 2, marginLeft = 0,
}, },
UI.Checkbox {
x = 3, y = -5,
label = 'Compress',
textColor = 'yellow',
backgroundColor = 'primary',
value = config.compression,
help = 'Compress packages (experimental)',
},
action = UI.SlideOut { action = UI.SlideOut {
titleBar = UI.TitleBar { titleBar = UI.TitleBar {
event = 'hide-action', event = 'hide-action',
@ -102,8 +113,6 @@ end
function page.action:show() function page.action:show()
self.output.win:clear() self.output.win:clear()
UI.SlideOut.show(self) UI.SlideOut.show(self)
--self.output:draw()
--self.output.win.redraw()
end end
function page:run(operation, name) function page:run(operation, name)
@ -127,7 +136,6 @@ end
function page:updateSelection(selected) function page:updateSelection(selected)
self.add.operation = selected.installed and 'update' or 'install' self.add.operation = selected.installed and 'update' or 'install'
self.add.operationText = selected.installed and 'Update' or 'Install' self.add.operationText = selected.installed and 'Update' or 'Install'
self.add.text = selected.installed and 'Update' or 'Install'
self.remove.inactive = not selected.installed self.remove.inactive = not selected.installed
self.add:draw() self.add:draw()
self.remove:draw() self.remove:draw()
@ -146,6 +154,10 @@ function page:eventHandler(event)
self.description:draw() self.description:draw()
self:updateSelection(event.selected) self:updateSelection(event.selected)
elseif event.type == 'checkbox_change' then
config.compression = not config.compression
Config.update('package', config)
elseif event.type == 'updateall' then elseif event.type == 'updateall' then
self.operation = 'updateall' self.operation = 'updateall'
self.action.button.text = ' Begin ' self.action.button.text = ' Begin '

View File

@ -1,14 +1,13 @@
local parentShell = _ENV.shell local parentShell = _ENV.shell
_ENV.shell = { } _ENV.shell = { }
local trace = require('opus.trace')
local Util = require('opus.util')
local fs = _G.fs local fs = _G.fs
local settings = _G.settings local settings = _G.settings
local shell = _ENV.shell local shell = _ENV.shell
local trace = require('opus.trace')
local Util = require('opus.util')
local DIR = (parentShell and parentShell.dir()) or "" local DIR = (parentShell and parentShell.dir()) or ""
local PATH = (parentShell and parentShell.path()) or ".:/rom/programs" local PATH = (parentShell and parentShell.path()) or ".:/rom/programs"
local tAliases = (parentShell and parentShell.aliases()) or {} local tAliases = (parentShell and parentShell.aliases()) or {}
@ -18,7 +17,7 @@ local bExit = false
local tProgramStack = {} local tProgramStack = {}
local function tokenise(...) local function tokenise(...)
local sLine = table.concat( { ... }, " " ) local sLine = table.concat({ ... }, ' ')
local tWords = { } local tWords = { }
local bQuoted = false local bQuoted = false
for match in string.gmatch(sLine .. "\"", "(.-)\"") do for match in string.gmatch(sLine .. "\"", "(.-)\"") do
@ -36,26 +35,27 @@ local function tokenise( ... )
end end
local defaultHandlers = { local defaultHandlers = {
function(args, env) function(env, command, args)
return args[1]:match("^(https?:)") and { return command:match("^(https?:)") and {
title = fs.getName(args[1]), title = fs.getName(command),
path = table.remove(args, 1), path = command,
args = args, args = args,
load = Util.loadUrl, load = Util.loadUrl,
env = shell.makeEnv(env), env = env,
} }
end, end,
function(args, env) function(env, command, args)
local command = shell.resolveProgram(table.remove(args, 1)) command = env.shell.resolveProgram(command)
or error('No such program') or error('No such program')
_G.requireInjector(env, fs.getDir(command))
return { return {
title = fs.getName(command):match('([^%.]+)'), title = fs.getName(command):match('([^%.]+)'),
path = command, path = command,
args = args, args = args,
load = loadfile, load = loadfile,
env = shell.makeEnv(env, fs.getDir(command)), env = env,
} }
end, end,
} }
@ -73,9 +73,9 @@ function shell.registerHandler(fn)
table.insert(handlers, 1, fn) table.insert(handlers, 1, fn)
end end
local function handleCommand(args, env) local function handleCommand(env, command, args)
for _,v in pairs(handlers) do for _,v in pairs(handlers) do
local pi = v(args, env) local pi = v(env, command, args)
if pi then if pi then
return pi return pi
end end
@ -88,7 +88,7 @@ local function run(...)
error('No such program') error('No such program')
end end
local pi = handleCommand(args, _ENV) local pi = handleCommand(shell.makeEnv(_ENV), table.remove(args, 1), args)
local O_v_O, err = pi.load(pi.path, pi.env) local O_v_O, err = pi.load(pi.path, pi.env)
if not O_v_O then if not O_v_O then
@ -149,10 +149,6 @@ function shell.resolveProgram( _sCommand )
_sCommand = tAliases[_sCommand] _sCommand = tAliases[_sCommand]
end end
if _sCommand:match("^(https?:)") then
return _sCommand
end
local path = shell.resolve(_sCommand) local path = shell.resolve(_sCommand)
if fs.exists(path) and not fs.isDir(path) then if fs.exists(path) and not fs.isDir(path) then
return path return path
@ -161,17 +157,8 @@ function shell.resolveProgram( _sCommand )
return path .. '.lua' return path .. '.lua'
end end
-- If the path is a global path, use it directly
local sStartChar = string.sub( _sCommand, 1, 1 )
if sStartChar == "/" or sStartChar == "\\" then
local sPath = fs.combine( "", _sCommand )
if fs.exists( sPath ) and not fs.isDir( sPath ) then
return sPath
end
return nil
end
-- Otherwise, look on the path variable -- Otherwise, look on the path variable
if not _sCommand:find('/') then
for sPath in string.gmatch(PATH or '', "[^:]+") do for sPath in string.gmatch(PATH or '', "[^:]+") do
sPath = fs.combine(sPath, _sCommand ) sPath = fs.combine(sPath, _sCommand )
if fs.exists(sPath) and not fs.isDir(sPath) then if fs.exists(sPath) and not fs.isDir(sPath) then
@ -181,8 +168,7 @@ function shell.resolveProgram( _sCommand )
return sPath .. '.lua' return sPath .. '.lua'
end end
end end
-- Not found end
return nil
end end
function shell.programs(_bIncludeHidden) function shell.programs(_bIncludeHidden)
@ -211,11 +197,12 @@ function shell.programs( _bIncludeHidden )
return tItemList return tItemList
end end
local function completeProgram( sLine ) function shell.completeProgram(sLine)
if #sLine > 0 and string.sub( sLine, 1, 1 ) == "/" then if #sLine > 0 and string.sub(sLine, 1, 1) == '/' then
-- Add programs from the root -- Add programs from the root
return fs.complete( sLine, "", true, false ) return fs.complete(sLine, '', true, false)
else end
local tResults = { } local tResults = { }
local tSeen = { } local tSeen = { }
@ -224,7 +211,7 @@ local function completeProgram( sLine )
if #sAlias > #sLine and string.sub(sAlias, 1, #sLine) == sLine then if #sAlias > #sLine and string.sub(sAlias, 1, #sLine) == sLine then
local sResult = string.sub(sAlias, #sLine + 1) local sResult = string.sub(sAlias, #sLine + 1)
if not tSeen[sResult] then if not tSeen[sResult] then
table.insert( tResults, sResult ) table.insert(tResults, sResult .. ' ')
tSeen[sResult] = true tSeen[sResult] = true
end end
end end
@ -234,10 +221,10 @@ local function completeProgram( sLine )
local tPrograms = shell.programs() local tPrograms = shell.programs()
for n=1,#tPrograms do for n=1,#tPrograms do
local sProgram = tPrograms[n] local sProgram = tPrograms[n]
if #sProgram > #sLine and string.sub( sProgram, 1, #sLine ) == sLine then if #sProgram >= #sLine and string.sub(sProgram, 1, #sLine) == sLine then
local sResult = string.sub(sProgram, #sLine + 1) local sResult = string.sub(sProgram, #sLine + 1)
if not tSeen[sResult] then if not tSeen[sResult] then
table.insert( tResults, sResult ) table.insert(tResults, sResult .. ' ')
tSeen[sResult] = true tSeen[sResult] = true
end end
end end
@ -247,54 +234,39 @@ local function completeProgram( sLine )
table.sort(tResults) table.sort(tResults)
return tResults return tResults
end end
end
local function completeProgramArgument( sProgram, nArgument, sPart, tPreviousParts )
local tInfo = tCompletionInfo[ sProgram ]
if tInfo then
return tInfo.fnComplete( shell, nArgument, sPart, tPreviousParts )
end
return nil
end
function shell.complete(sLine) function shell.complete(sLine)
if #sLine > 0 then
local tWords = tokenise(sLine) local tWords = tokenise(sLine)
local nIndex = #tWords local nIndex = #tWords
if string.sub( sLine, #sLine, #sLine ) == " " then if string.sub(sLine, #sLine, #sLine) == ' ' and #Util.trim(sLine) > 0 then
nIndex = nIndex + 1 nIndex = nIndex + 1
end end
if nIndex == 1 then
local sBit = tWords[1] or ""
local sPath = shell.resolveProgram( sBit )
if tCompletionInfo[ sPath ] then
return { " " }
else
local tResults = completeProgram( sBit )
for n=1,#tResults do
local sResult = tResults[n]
local cPath = shell.resolveProgram( sBit .. sResult )
if tCompletionInfo[ cPath ] then
tResults[n] = sResult .. " "
end
end
return tResults
end
elseif nIndex > 1 then if nIndex == 0 then
return fs.complete('', shell.dir(), true, false)
elseif nIndex == 1 then
local results = shell.completeProgram(tWords[1] or '')
for _, v in pairs(fs.complete(table.concat(tWords, ' '), shell.dir(), true, false)) do
table.insert(results, v)
end
return results
else
local sPath = shell.resolveProgram(tWords[1]) local sPath = shell.resolveProgram(tWords[1])
local sPart = tWords[nIndex] or "" local sPart = tWords[nIndex] or ''
local tPreviousParts = tWords local tPreviousParts = tWords
tPreviousParts[nIndex] = nil tPreviousParts[nIndex] = nil
return completeProgramArgument( sPath , nIndex - 1, sPart, tPreviousParts ) local results
local tInfo = tCompletionInfo[sPath]
if tInfo then
results = tInfo.fnComplete(shell, nIndex - 1, sPart, tPreviousParts)
end end
return results and #results > 0 and results
or fs.complete(sPart, shell.dir(), true, false)
end end
end end
function shell.completeProgram( sProgram )
return completeProgram( sProgram )
end
function shell.setCompletionFunction(sProgram, fnComplete) function shell.setCompletionFunction(sProgram, fnComplete)
tCompletionInfo[sProgram] = { fnComplete = fnComplete } tCompletionInfo[sProgram] = { fnComplete = fnComplete }
end end
@ -394,23 +366,16 @@ local textutils = _G.textutils
local oldTerm local oldTerm
local terminal = term.current() local terminal = term.current()
local _len = string.len
local _rep = string.rep local _rep = string.rep
local _sub = string.sub local _sub = string.sub
if not terminal.scrollUp then
terminal = Terminal.window(term.current())
terminal.setMaxScroll(200)
oldTerm = term.redirect(terminal)
end
local config = { local config = {
color = { color = {
textColor = colors.white, textColor = colors.white,
commandTextColor = colors.yellow, commandTextColor = colors.yellow,
directoryTextColor = colors.orange, directoryTextColor = colors.orange,
directoryBackgroundColor = colors.black,
promptTextColor = colors.blue, promptTextColor = colors.blue,
promptBackgroundColor = colors.black,
directoryColor = colors.green, directoryColor = colors.green,
fileColor = colors.white, fileColor = colors.white,
backgroundColor = colors.black, backgroundColor = colors.black,
@ -427,43 +392,15 @@ if not _colors.backgroundColor then
_colors.fileColor = colors.white _colors.fileColor = colors.white
end end
local palette = { } if not terminal.scrollUp then
for n = 1, 16 do terminal = Terminal.window(term.current())
palette[2 ^ (n - 1)] = _sub("0123456789abcdef", n, n) terminal.setMaxScroll(200)
oldTerm = term.redirect(terminal)
term.setBackgroundColor(_colors.backgroundColor)
term.clear()
end end
if not term.isColor() then local palette = terminal.canvas.palette
_colors = { }
for k, v in pairs(config.color) do
_colors[k] = Terminal.colorToGrayscale(v)
end
for n = 1, 16 do
palette[2 ^ (n - 1)] = _sub("088888878877787f", n, n)
end
end
local function autocompleteArgument(program, words)
local word = ''
if #words > 1 then
word = words[#words]
end
local tInfo = tCompletionInfo[program]
return tInfo.fnComplete(shell, #words - 1, word, words)
end
local function autocompleteAnything(line, words)
local results = shell.complete(line)
if results and #results == 0 and #words == 1 then
results = nil
end
if not results then
results = fs.complete(words[#words] or '', shell.dir(), true, false)
end
return results
end
local function autocomplete(line) local function autocomplete(line)
local words = { } local words = { }
@ -477,14 +414,7 @@ local function autocomplete(line)
words = { '' } words = { '' }
end end
local results local results = shell.complete(line) or { }
local program = shell.resolveProgram(words[1])
if tCompletionInfo[program] then
results = autocompleteArgument(program, words) or { }
else
results = autocompleteAnything(line, words) or { }
end
Util.filterInplace(results, function(f) Util.filterInplace(results, function(f)
return not Util.key(results, f .. '/') return not Util.key(results, f .. '/')
@ -497,8 +427,8 @@ local function autocomplete(line)
if #results == 1 then if #results == 1 then
words[#words] = results[1] words[#words] = results[1]
return table.concat(words, ' ') return table.concat(words, ' ')
elseif #results > 1 then
elseif #results > 1 then
local function someComplete() local function someComplete()
-- ugly (complete as much as possible) -- ugly (complete as much as possible)
local word = words[#words] or '' local word = words[#words] or ''
@ -507,16 +437,16 @@ local function autocomplete(line)
local ch local ch
for _,f in ipairs(results) do for _,f in ipairs(results) do
if #f < i then if #f < i then
words[#words] = string.sub(f, 1, i - 1) words[#words] = _sub(f, 1, i - 1)
return table.concat(words, ' ') return table.concat(words, ' ')
end end
if not ch then if not ch then
ch = string.sub(f, i, i) ch = _sub(f, i, i)
elseif string.sub(f, i, i) ~= ch then elseif _sub(f, i, i) ~= ch then
if i == #word + 1 then if i == #word + 1 then
return return
end end
words[#words] = string.sub(f, 1, i - 1) words[#words] = _sub(f, 1, i - 1)
return table.concat(words, ' ') return table.concat(words, ' ')
end end
end end
@ -559,10 +489,9 @@ local function autocomplete(line)
local tw = term.getSize() local tw = term.getSize()
local nMaxLen = tw / 8 local nMaxLen = tw / 8
for _,sItem in pairs(results) do for _,sItem in pairs(results) do
nMaxLen = math.max(string.len(sItem) + 1, nMaxLen) nMaxLen = math.max(_len(sItem) + 1, nMaxLen)
end end
local w = term.getSize() local nCols = math.floor(tw / nMaxLen)
local nCols = math.floor(w / nMaxLen)
if #tDirs < nCols then if #tDirs < nCols then
for _ = #tDirs + 1, nCols do for _ = #tDirs + 1, nCols do
table.insert(tDirs, '') table.insert(tDirs, '')
@ -577,11 +506,9 @@ local function autocomplete(line)
end end
term.setTextColour(_colors.promptTextColor) term.setTextColour(_colors.promptTextColor)
term.setBackgroundColor(_colors.promptBackgroundColor)
term.write("$ " ) term.write("$ " )
term.setTextColour(_colors.commandTextColor) term.setTextColour(_colors.commandTextColor)
term.setBackgroundColor(_colors.backgroundColor)
return line return line
end end
end end
@ -608,17 +535,16 @@ local function shellRead(history)
term.setCursorPos(3, cy) term.setCursorPos(3, cy)
entry.value = entry.value or '' entry.value = entry.value or ''
local filler = #entry.value < lastLen local filler = #entry.value < lastLen
and string.rep(' ', lastLen - #entry.value) and _rep(' ', lastLen - #entry.value)
or '' or ''
local str = string.sub(entry.value, entry.scroll + 1, entry.width + entry.scroll) .. filler local str = _sub(entry.value, entry.scroll + 1, entry.width + entry.scroll) .. filler
local fg = _rep(palette[_colors.commandTextColor], #str) local fg = _rep(palette[_colors.commandTextColor], #str)
local bg = _rep(palette[_colors.backgroundColor], #str) local bg = _rep(palette[_colors.backgroundColor], #str)
if entry.mark.active then if entry.mark.active then
local sx = entry.mark.x - entry.scroll + 1 bg = _rep('f', entry.mark.x) ..
local ex = entry.mark.ex - entry.scroll + 1 _rep('7', entry.mark.ex - entry.mark.x) ..
bg = string.rep('f', sx - 1) .. _rep('f', #entry.value - entry.mark.ex + #filler + 1)
string.rep('7', ex - sx) .. bg = _sub(bg, entry.scroll + 1, entry.scroll + #str)
string.rep('f', #str - ex + 1)
end end
term.blit(str, fg, bg) term.blit(str, fg, bg)
updateCursor() updateCursor()
@ -696,27 +622,19 @@ end
local history = History.load('usr/.shell_history', 100) local history = History.load('usr/.shell_history', 100)
term.setBackgroundColor(_colors.backgroundColor) term.setBackgroundColor(_colors.backgroundColor)
--term.clear()
if settings.get("motd.enabled") then if settings.get("motd.enable") then
shell.run("motd") shell.run("motd")
end end
while not bExit do while not bExit do
local cx = term.getCursorPos()
if cx ~= 1 then
print()
end
if config.displayDirectory then if config.displayDirectory then
term.setTextColour(_colors.directoryTextColor) term.setTextColour(_colors.directoryTextColor)
term.setBackgroundColor(_colors.directoryBackgroundColor)
print('==' .. os.getComputerLabel() .. ':/' .. DIR) print('==' .. os.getComputerLabel() .. ':/' .. DIR)
end end
term.setTextColour(_colors.promptTextColor) term.setTextColour(_colors.promptTextColor)
term.setBackgroundColor(_colors.promptBackgroundColor)
term.write("$ " ) term.write("$ " )
term.setTextColour(_colors.commandTextColor) term.setTextColour(_colors.commandTextColor)
term.setBackgroundColor(_colors.backgroundColor)
local sLine = shellRead(history) local sLine = shellRead(history)
if bExit then -- terminated if bExit then -- terminated
break break
@ -728,6 +646,11 @@ while not bExit do
term.setTextColour(_colors.textColor) term.setTextColour(_colors.textColor)
if #sLine > 0 then if #sLine > 0 then
local result, err = shell.run(sLine) local result, err = shell.run(sLine)
local cx = term.getCursorPos()
if cx ~= 1 then
print()
end
term.setBackgroundColor(_colors.backgroundColor)
if not result and err then if not result and err then
_G.printError(err) _G.printError(err)
end end

View File

@ -18,9 +18,7 @@ local defaults = {
textColor = colors.white, textColor = colors.white,
commandTextColor = colors.yellow, commandTextColor = colors.yellow,
directoryTextColor = colors.orange, directoryTextColor = colors.orange,
directoryBackgroundColor = colors.black,
promptTextColor = colors.blue, promptTextColor = colors.blue,
promptBackgroundColor = colors.black,
directoryColor = colors.green, directoryColor = colors.green,
fileColor = colors.white, fileColor = colors.white,
backgroundColor = colors.black, backgroundColor = colors.black,
@ -86,12 +84,12 @@ return UI.Tab {
if config.displayDirectory then if config.displayDirectory then
self:write(1, 1, self:write(1, 1,
'==' .. os.getComputerLabel() .. ':/dir/etc', '==' .. os.getComputerLabel() .. ':/dir/etc',
_colors.directoryBackgroundColor, _colors.directoryTextColor) _colors.backgroundColor, _colors.directoryTextColor)
offset = 1 offset = 1
end end
self:write(1, 1 + offset, '$ ', self:write(1, 1 + offset, '$ ',
_colors.promptBackgroundColor, _colors.promptTextColor) _colors.backgroundColor, _colors.promptTextColor)
self:write(3, 1 + offset, 'ls /', self:write(3, 1 + offset, 'ls /',
_colors.backgroundColor, _colors.commandTextColor) _colors.backgroundColor, _colors.commandTextColor)

View File

@ -222,7 +222,7 @@ function Entry:paste(ie)
end end
end end
function Entry:forcePaste() function Entry.forcePaste()
os.queueEvent('clipboard_paste') os.queueEvent('clipboard_paste')
end end
@ -234,7 +234,9 @@ end
function Entry:markBegin() function Entry:markBegin()
if not self.mark.active then if not self.mark.active then
if #_val(self.value) > 0 then
self.mark.active = true self.mark.active = true
end
self.mark.anchor = { x = self.pos } self.mark.anchor = { x = self.pos }
end end
end end
@ -271,6 +273,8 @@ function Entry:markLeft()
self:markBegin() self:markBegin()
if self:moveLeft() then if self:moveLeft() then
self:markFinish() self:markFinish()
else
self.mark.continue = self.mark.active
end end
end end
@ -278,6 +282,8 @@ function Entry:markRight()
self:markBegin() self:markBegin()
if self:moveRight() then if self:moveRight() then
self:markFinish() self:markFinish()
else
self.mark.continue = self.mark.active
end end
end end
@ -305,6 +311,8 @@ function Entry:markNextWord()
self:markBegin() self:markBegin()
if self:moveWordRight() then if self:moveWordRight() then
self:markFinish() self:markFinish()
else
self.mark.continue = self.mark.active
end end
end end
@ -312,6 +320,8 @@ function Entry:markPrevWord()
self:markBegin() self:markBegin()
if self:moveWordLeft() then if self:moveWordLeft() then
self:markFinish() self:markFinish()
else
self.mark.continue = self.mark.active
end end
end end
@ -330,6 +340,8 @@ function Entry:markHome()
self:markBegin() self:markBegin()
if self:moveHome() then if self:moveHome() then
self:markFinish() self:markFinish()
else
self.mark.continue = self.mark.active
end end
end end
@ -337,6 +349,8 @@ function Entry:markEnd()
self:markBegin() self:markBegin()
if self:moveEnd() then if self:moveEnd() then
self:markFinish() self:markFinish()
else
self.mark.continue = self.mark.active
end end
end end

View File

@ -989,6 +989,7 @@ function UI.Device:postInit()
self.device.setTextScale = function() end self.device.setTextScale = function() end
end end
self._obg = term.getBackgroundColor()
self.device.setTextScale(self.textScale) self.device.setTextScale(self.textScale)
self.width, self.height = self.device.getSize() self.width, self.height = self.device.getSize()
self.isColor = self.device.isColor() self.isColor = self.device.isColor()
@ -1025,8 +1026,7 @@ function UI.Device:setTextScale(textScale)
end end
function UI.Device:reset() function UI.Device:reset()
self.device.setBackgroundColor(colors.black) self.device.setBackgroundColor(self._obg)
self.device.setTextColor(colors.white)
self.device.clear() self.device.clear()
self.device.setCursorPos(1, 1) self.device.setCursorPos(1, 1)
end end