2017-10-08 21:45:01 +00:00
|
|
|
_G.requireInjector()
|
2017-10-14 07:41:54 +00:00
|
|
|
|
2017-09-05 06:09:31 +00:00
|
|
|
local Util = require('util')
|
2017-10-14 07:41:54 +00:00
|
|
|
|
|
|
|
local multishell = _ENV.multishell
|
2017-10-15 06:36:54 +00:00
|
|
|
local textutils = _G.textutils
|
2017-09-05 06:09:31 +00:00
|
|
|
|
2017-10-15 23:55:05 +00:00
|
|
|
local data
|
2017-05-12 05:12:58 +00:00
|
|
|
|
2017-10-14 07:41:54 +00:00
|
|
|
multishell.hook('clipboard_copy', function(_, args)
|
2017-10-15 23:55:05 +00:00
|
|
|
data = args[1]
|
2017-10-14 07:41:54 +00:00
|
|
|
end)
|
|
|
|
|
2017-10-15 23:55:05 +00:00
|
|
|
multishell.addHotkey('shift-paste', function(_, args)
|
|
|
|
if type(data) == 'table' then
|
|
|
|
local s, m = pcall(textutils.serialize, data)
|
|
|
|
data = (s and m) or Util.tostring(data)
|
2017-10-14 07:41:54 +00:00
|
|
|
end
|
2017-10-15 23:55:05 +00:00
|
|
|
-- replace the event paste data with our internal data
|
|
|
|
args[1] = Util.tostring(data or '')
|
2017-10-14 07:41:54 +00:00
|
|
|
end)
|