diff --git a/startup b/startup index a6631fb..47678d3 100644 --- a/startup +++ b/startup @@ -6,7 +6,7 @@ local term = _G.term local bootOptions = { { prompt = os.version() }, { prompt = 'Opus' , args = { '/sys/boot/opus.boot' } }, - { prompt = 'Opus Shell' , args = { '/sys/boot/opus.boot', 'sys/apps/shell' } }, + { prompt = 'Opus Shell' , args = { '/sys/boot/opus.boot', 'sys/apps/shell.lua' } }, { prompt = 'Opus Kiosk' , args = { '/sys/boot/kiosk.boot' } }, } local bootOption = 2 diff --git a/sys/apis/terminal.lua b/sys/apis/terminal.lua index bfac681..904f36e 100644 --- a/sys/apis/terminal.lua +++ b/sys/apis/terminal.lua @@ -25,8 +25,8 @@ function Terminal.window(parent, sx, sy, w, h, isVisible) width = w, height = h, isColor = parent.isColor(), + offy = 0, }) - canvas.offy = 0 win.canvas = canvas @@ -164,7 +164,7 @@ function Terminal.window(parent, sx, sy, w, h, isVisible) function win.redraw() if isVisible then canvas:dirty() - canvas:render(parent) + update() end end diff --git a/sys/apis/ui/canvas.lua b/sys/apis/ui/canvas.lua index 55f2977..d980845 100644 --- a/sys/apis/ui/canvas.lua +++ b/sys/apis/ui/canvas.lua @@ -198,10 +198,12 @@ function Canvas:blit(x, y, text, bg, fg) end function Canvas:writeLine(y, text, fg, bg) - self.lines[y].dirty = true - self.lines[y].text = text - self.lines[y].fg = fg - self.lines[y].bg = bg + if y > 0 and y <= #self.lines then + self.lines[y].dirty = true + self.lines[y].text = text + self.lines[y].fg = fg + self.lines[y].bg = bg + end end function Canvas:clearLine(y, bg, fg) diff --git a/sys/apis/ui/components/Checkbox.lua b/sys/apis/ui/components/Checkbox.lua index 9f2c174..a780c42 100644 --- a/sys/apis/ui/components/Checkbox.lua +++ b/sys/apis/ui/components/Checkbox.lua @@ -15,20 +15,12 @@ UI.Checkbox.defaults = { backgroundColor = colors.black, backgroundFocusColor = colors.lightGray, height = 1, + width = 3, accelerators = { space = 'checkbox_toggle', mouse_click = 'checkbox_toggle', } } -function UI.Checkbox:setParent() - if not self.width and not self.ex then - self.width = (self.label and #self.label or 0) + 3 - else - self.width = 3 - end - UI.Window.setParent(self) -end - function UI.Checkbox:draw() local bg = self.backgroundColor if self.focused then diff --git a/sys/apps/Files.lua b/sys/apps/Files.lua index 1053e79..2e065ba 100644 --- a/sys/apps/Files.lua +++ b/sys/apps/Files.lua @@ -347,7 +347,7 @@ function Browser:eventHandler(event) self:run('cedit', file.name) elseif event.type == 'shell' then - self:run('sys/apps/shell') + self:run('sys/apps/shell.lua') elseif event.type == 'refresh' then self:updateDirectory(self.dir) diff --git a/sys/apps/Lua.lua b/sys/apps/Lua.lua index dd50147..a1a3385 100644 --- a/sys/apps/Lua.lua +++ b/sys/apps/Lua.lua @@ -1,8 +1,5 @@ -if not _G.requireInjector then - local BASE ='https://raw.githubusercontent.com/kepler155c/opus/develop-1.8/sys/apis' - _ENV.LUA_PATH=BASE .. '/?.lua' - load(_G.http.get(BASE .. '/injector.lua').readAll())()(_ENV) -end +-- Lua may be called from outside of shell - inject a require +_G.requireInjector(_ENV) local History = require('history') local UI = require('ui') diff --git a/sys/apps/Overview.lua b/sys/apps/Overview.lua index 7deedda..952137d 100644 --- a/sys/apps/Overview.lua +++ b/sys/apps/Overview.lua @@ -424,7 +424,7 @@ function page:eventHandler(event) shell.switchTab(shell.openTab(event.button.app.run)) elseif event.type == 'shell' then - shell.switchTab(shell.openTab('sys/apps/shell')) + shell.switchTab(shell.openTab('sys/apps/shell.lua')) elseif event.type == 'lua' then shell.switchTab(shell.openTab('sys/apps/Lua.lua')) diff --git a/sys/apps/PackageManager.lua b/sys/apps/PackageManager.lua index 73cd78b..cdd1641 100644 --- a/sys/apps/PackageManager.lua +++ b/sys/apps/PackageManager.lua @@ -36,7 +36,6 @@ local page = UI.Page { description = UI.TextArea { x = 16, y = 3, ey = -5, marginRight = 0, marginLeft = 0, - --backgroundColor = colors.white, }, load = UI.Button { x = 22, y = -3, @@ -45,10 +44,8 @@ local page = UI.Page { help = 'Download the latest package list', }, action = UI.SlideOut { - backgroundColor = colors.brown, - y = 3, + backgroundColor = colors.cyan, titleBar = UI.TitleBar { - backgroundColor = colors.brown, event = 'hide-action', }, button = UI.Button { diff --git a/sys/apps/shell b/sys/apps/shell.lua similarity index 98% rename from sys/apps/shell rename to sys/apps/shell.lua index d9da2e2..68fc0b3 100644 --- a/sys/apps/shell +++ b/sys/apps/shell.lua @@ -314,9 +314,9 @@ function shell.newTab(tabInfo, ...) tabInfo.args = args tabInfo.title = fs.getName(path):match('([^%.]+)') - if path ~= 'sys/apps/shell' then + if path ~= 'sys/apps/shell.lua' then table.insert(tabInfo.args, 1, tabInfo.path) - tabInfo.path = 'sys/apps/shell' + tabInfo.path = 'sys/apps/shell.lua' end return _ENV.multishell.openTab(tabInfo) end @@ -329,10 +329,10 @@ function shell.openTab( ... ) local sCommand = tWords[1] if sCommand then local sPath = shell.resolveProgram(sCommand) - if sPath == "sys/apps/shell" then + if sPath == "sys/apps/shell.lua" then return _ENV.multishell.launch(Util.shallowCopy(sandboxEnv), sPath, table.unpack(tWords, 2)) else - return _ENV.multishell.launch(Util.shallowCopy(sandboxEnv), "sys/apps/shell", sCommand, table.unpack(tWords, 2)) + return _ENV.multishell.launch(Util.shallowCopy(sandboxEnv), "sys/apps/shell.lua", sCommand, table.unpack(tWords, 2)) end end end diff --git a/sys/autorun/upgraded.lua b/sys/autorun/upgraded.lua new file mode 100644 index 0000000..4992f7d --- /dev/null +++ b/sys/autorun/upgraded.lua @@ -0,0 +1,3 @@ +if fs.exists('sys/apps/shell') and fs.exists('sys/apps/shell.lua') then + fs.delete('sys/apps/shell') +end diff --git a/sys/boot/opus.boot b/sys/boot/opus.boot index 2f64980..69b90d3 100644 --- a/sys/boot/opus.boot +++ b/sys/boot/opus.boot @@ -64,7 +64,7 @@ else fs.mount('', 'gitfs', GIT_REPO) end -local s, m = pcall(run, 'sys/apps/shell', 'sys/kernel.lua', ...) +local s, m = pcall(run, 'sys/apps/shell.lua', 'sys/kernel.lua', ...) if not s then print('\nError loading Opus OS\n') diff --git a/sys/kernel.lua b/sys/kernel.lua index 407f217..bad6b82 100644 --- a/sys/kernel.lua +++ b/sys/kernel.lua @@ -278,7 +278,7 @@ local function init(...) kernel.hook('kernel_ready', function() local s, m = kernel.run({ title = args[1], - path = 'sys/apps/shell', + path = 'sys/apps/shell.lua', args = args, haltOnExit = true, haltOnError = true, diff --git a/sys/network/telnet.lua b/sys/network/telnet.lua index c0d5f07..e840a6e 100644 --- a/sys/network/telnet.lua +++ b/sys/network/telnet.lua @@ -46,7 +46,7 @@ local function telnetHost(socket) title = 'Telnet client', hidden = true, co = coroutine.create(function() - Util.run(_ENV, 'sys/apps/shell', table.unpack(termInfo.program)) + Util.run(_ENV, 'sys/apps/shell.lua', table.unpack(termInfo.program)) if socket.queue then socket:write(socket.queue) end