Either way, thanks Dan!
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
Paste Event
Started by oeed, 28 February 2015 - 07:47 AMPosted 28 February 2015 - 08:47 AM
So I've been redoing the OneOS clipboard to be less of a pain and I was trying detect the char events from a paste, but they simply weren't happening. A bit of Lua prompt testing and I found that there's actually a paste event. I couldn't really find anything in the change logs or on the forums about it. So, when was this added? I'm pretty sure in 1.4 and probably 1.5 it didn't exist, but I might be wrong.
Either way, thanks Dan!
Either way, thanks Dan!
Posted 28 February 2015 - 09:02 AM
It was added in 1.6 but it will only deliver first line of text (Stops at first line break) from clipboard so no pasting multi-line file for you. Still for fast pasting line of code its great. Hmm that gives me an idea. Replace line breaks with a marker and then have lua code replace marker with line-breaks again. That could smuggle large file via clipboard. Wonder if there is size limit of that event.
Edited on 28 February 2015 - 08:04 AM
Posted 28 February 2015 - 11:47 AM
To memory, the size limit is some power of two. Probably seven or eight.
Posted 28 February 2015 - 11:50 AM
That could smuggle large file via clipboard. Wonder if there is size limit of that event.
while doing research for the Keyboard in MoarPeripherals I discovered that the character limit is 128 characters (so 27). And yes, it also only does the first line, whether the line break is \r \n or \r\n so there's no tricking CC into allowing multi-lines.To memory, the size limit is some power of two. Probably seven or eight.
Edited on 28 February 2015 - 10:52 AM
Posted 28 February 2015 - 12:08 PM
Well there goes that idea…the character limit is 128 characters
Posted 28 February 2015 - 01:21 PM
I really don't see the point of the size limit and line break limit. They don't achieve anything other than be a pain.
Posted 28 February 2015 - 09:14 PM
They prevent players from flooding servers by pasting multiple-megabyte chunks of text repeatedly.
Posted 28 February 2015 - 10:00 PM
Line breaks don't really add anything to help people "flood servers", I have a feeling the line break restriction is more for the fact of Dan didn't wish to invest the time into making the paste logic in Edit support multi-line data. It is definitely more complicated logic as opposed to just a single line paste.
Edited on 28 February 2015 - 09:00 PM
Posted 06 March 2015 - 03:54 AM
He was referring to the 128byte data restrictionLine breaks don't really add anything to help people "flood servers", I have a feeling the line break restriction is more for the fact of Dan didn't wish to invest the time into making the paste logic in Edit support multi-line data. It is definitely more complicated logic as opposed to just a single line paste.
These events have existed for as long as you have been able to paste things into the shell
Edited on 06 March 2015 - 02:55 AM
Posted 06 March 2015 - 05:28 AM
I'm fairly certain the original implementation of pasting was just a stream of char events, and that the paste event was specifically added at some point, though I couldn't be sure when.
Posted 06 March 2015 - 06:57 AM
Indeed, it was another 1.6 change.