transition to kernel
This commit is contained in:
@@ -1,67 +1,26 @@
|
||||
_G.requireInjector()
|
||||
_G.requireInjector(_ENV)
|
||||
|
||||
--[[
|
||||
Adds the control-d hotkey to view the kernel log.
|
||||
]]
|
||||
|
||||
local Terminal = require('terminal')
|
||||
Adds a task and the control-d hotkey to view the kernel log.
|
||||
--]]
|
||||
|
||||
local kernel = _G.kernel
|
||||
local keyboard = _G.device.keyboard
|
||||
local multishell = _ENV.multishell
|
||||
local os = _G.os
|
||||
local term = _G.term
|
||||
local window = _G.window
|
||||
|
||||
if multishell and multishell.setTitle then
|
||||
if multishell then
|
||||
multishell.setTitle(multishell.getCurrent(), 'System Log')
|
||||
end
|
||||
|
||||
-- jump through a lot of hoops to get around window api limitations
|
||||
-- mainly failing to provide access to window buffer or knowledge of parent
|
||||
-- need: window.getParent()
|
||||
-- window.copy(target)
|
||||
|
||||
local terminal = _G.kernel.terminal
|
||||
local w, h = kernel.window.getSize()
|
||||
local win = window.create(kernel.window, 1, 1, w, h + 50, false)
|
||||
|
||||
-- copy windows contents from parent window to child
|
||||
local oblit, oscp = terminal.blit, terminal.setCursorPos
|
||||
kernel.window.setVisible(false)
|
||||
terminal.blit = function(...)
|
||||
win.blit(...)
|
||||
end
|
||||
terminal.setCursorPos = function(...)
|
||||
win.setCursorPos(...)
|
||||
end
|
||||
kernel.window.setVisible(true)
|
||||
|
||||
-- position and resize window for multishell (but don't update screen)
|
||||
terminal.blit = function() end
|
||||
terminal.setCursorPos = function() end
|
||||
kernel.window.reposition(1, 2, w, h - 1)
|
||||
|
||||
-- restore original terminal
|
||||
terminal.blit = oblit
|
||||
terminal.setCursorPos = oscp
|
||||
|
||||
-- add scrolling methods
|
||||
Terminal.scrollable(win, kernel.window)
|
||||
|
||||
-- update kernel with new window, set this tab with the new kernal window
|
||||
local routine = kernel.getCurrent()
|
||||
for _,r in pairs(kernel.routines) do
|
||||
if r.terminal == kernel.window then
|
||||
r.terminal = win
|
||||
r.window = win
|
||||
end
|
||||
end
|
||||
--kernel.terminal = win
|
||||
kernel.window = win
|
||||
routine.terminal = win
|
||||
routine.window = win
|
||||
term.redirect(routine.window)
|
||||
routine.terminal = kernel.window
|
||||
routine.window = kernel.window
|
||||
term.redirect(kernel.window)
|
||||
|
||||
local previousId
|
||||
|
||||
@@ -69,8 +28,8 @@ kernel.hook('mouse_scroll', function(_, eventData)
|
||||
local dir, y = eventData[1], eventData[3]
|
||||
|
||||
if y > 1 then
|
||||
local currentTab = kernel.routines[1]
|
||||
if currentTab.terminal.scrollUp then
|
||||
local currentTab = kernel.getFocused()
|
||||
if currentTab.terminal.scrollUp and not currentTab.terminal.noAutoScroll then
|
||||
if dir == -1 then
|
||||
currentTab.terminal.scrollUp()
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user