here is the code. My setup is just a computer (turtle in my case) below monitors.
text = ""
mon = peripheral.wrap("top")
mon.setTextScale(3)
mon.setTextColor(colors.blue)
mon.setCursorBlink(true)
ctrlDown = false
while true do
p1, p2,p3 = os.pullEvent()
print(p1,p2,p3)
if p1 == "char" then
if ctrlDown and p2 == "z" then
text = text.." "..last
else
text = text..p2
end
elseif p1 == "key" then
if p2 == 14 then
if ctrlDown then
local first = string.match(text, "(.-)%s(%S+)$") or ""
text = first
else
text = string.sub(text, 1,string.len(text)-1) or ""
end
elseif p2 == 29 or p2 == 157 then
ctrlDown = true
end
elseif p1 == "key_up" then
if p2 == 29 or p2 == 157 then
ctrlDown = false
end
end
mon.clear()
mon.setCursorPos(1,1)
-- mon.write(text)
local tSelf = term.redirect(mon)
textutils.pagedPrint(text)
-- mon.print(text)
term.redirect(tSelf)
end