-- multiclip.lua

--[[ in menu.cfg
luamacro(copy_to(1), Copy to internal Clipboard 1)
luamacro(copy_to(2), Copy to internal Clipboard 2)
luamacro(copy_to(3), Copy to internal Clipboard 3)

luamacro(paste_from(1), Paste from internal Clipboard 1)
luamacro(paste_from(2), Paste from internal Clipboard 2)
luamacro(paste_from(3), Paste from internal Clipboard 3)
]]

multiclip = {}

function copy_to(label)
	local tmp
	if label then
		tmp = km.getclipboard()
		km.id("ID_EDIT_COPY")
		multiclip[label] = km.getclipboard()
		km.setclipboard(tmp)
	end
end

function paste_from(label)
	local tmp
	if multiclip[label] then
		tmp = km.getclipboard()
		km.setclipboard(multiclip[label])
		km.id("ID_EDIT_PASTE")
		km.setclipboard(tmp)
	end
end
