mirror of
https://github.com/kepler155c/opus
synced 2024-12-31 19:00:27 +00:00
Events shows all + tweaks
This commit is contained in:
parent
f2cf20c274
commit
e9717c4def
@ -20,6 +20,7 @@ local config = Config.load('Files', {
|
||||
})
|
||||
config.associations = config.associations or {
|
||||
nft = 'pain',
|
||||
txt = 'edit',
|
||||
}
|
||||
|
||||
local copied = { }
|
||||
|
@ -1,5 +1,6 @@
|
||||
_G.requireInjector(_ENV)
|
||||
|
||||
local Array = require('opus.array')
|
||||
local Terminal = require('opus.terminal')
|
||||
local Util = require('opus.util')
|
||||
|
||||
@ -55,7 +56,7 @@ end
|
||||
function kernel.unhook(event, fn)
|
||||
local eventHooks = kernel.hooks[event]
|
||||
if eventHooks then
|
||||
Util.removeByValue(eventHooks, fn)
|
||||
Array.removeByValue(eventHooks, fn)
|
||||
if #eventHooks == 0 then
|
||||
kernel.hooks[event] = nil
|
||||
end
|
||||
@ -107,7 +108,7 @@ function Routine:resume(event, ...)
|
||||
error(result, -1)
|
||||
end
|
||||
if coroutine.status(self.co) == 'dead' then
|
||||
Util.removeByValue(kernel.routines, self)
|
||||
Array.removeByValue(kernel.routines, self)
|
||||
if #kernel.routines > 0 then
|
||||
switch(kernel.routines[1])
|
||||
end
|
||||
@ -188,7 +189,7 @@ function kernel.raise(uid)
|
||||
if routine then
|
||||
local previous = kernel.routines[1]
|
||||
if routine ~= previous then
|
||||
Util.removeByValue(kernel.routines, routine)
|
||||
Array.removeByValue(kernel.routines, routine)
|
||||
table.insert(kernel.routines, 1, routine)
|
||||
end
|
||||
|
||||
@ -211,7 +212,7 @@ function kernel.lower(uid)
|
||||
end
|
||||
end
|
||||
|
||||
Util.removeByValue(kernel.routines, routine)
|
||||
Array.removeByValue(kernel.routines, routine)
|
||||
table.insert(kernel.routines, routine)
|
||||
return true
|
||||
end
|
||||
@ -229,7 +230,17 @@ end
|
||||
function kernel.event(event, eventData)
|
||||
local stopPropagation
|
||||
|
||||
local eventHooks = kernel.hooks[event]
|
||||
local eventHooks = kernel.hooks['*']
|
||||
if eventHooks then
|
||||
for i = #eventHooks, 1, -1 do
|
||||
stopPropagation = eventHooks[i](event, eventData)
|
||||
if stopPropagation then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
eventHooks = kernel.hooks[event]
|
||||
if eventHooks then
|
||||
for i = #eventHooks, 1, -1 do
|
||||
stopPropagation = eventHooks[i](event, eventData)
|
||||
|
@ -10,4 +10,13 @@ function Array.filter(it, f)
|
||||
return ot
|
||||
end
|
||||
|
||||
function Array.removeByValue(t, e)
|
||||
for k,v in pairs(t) do
|
||||
if v == e then
|
||||
table.remove(t, k)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return Array
|
||||
|
@ -48,6 +48,10 @@ function ramfs.getDrive()
|
||||
return 'ram'
|
||||
end
|
||||
|
||||
function ramfs.getFreeSpace()
|
||||
return math.huge
|
||||
end
|
||||
|
||||
function ramfs.list(node, dir)
|
||||
if node.nodes and node.mountPoint == dir then
|
||||
local files = { }
|
||||
|
Loading…
Reference in New Issue
Block a user