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