Pasting in input boxes
Posted: Jul 22nd, '17, 11:20
I imagine the problem holds in greater generality, but you can paste things that should not be there into input boxes and this *could* lead to more breakages?
# What is wrong?
If there is an input box which is number only, you can still paste other characters in.
# How to recreate error?
Go to operators and bring out an addition block or an "is it prime" block. Now open a text editor and write any character which should not be there, e.g. "two" or ",!"£$£$%^&*()" or so on, and copy this text and paste into the block.
Is it prime does indeed return false for these, but given longer to play with one could find something which breaks a function more.
I initially found the error by pasting in a long number using a comma. (There is also the fact that in different cultures some people use ',' rather than '.' to separate integers and rational or irrational floors. (but rational as on a computer)
# Proposal for fixing it
You could see if you can strip characters when pasting. I know this is possible in other languages, but do not know GP well enough to test it. Essentially, when pasting, you save it as a temporary variable, and then you search and replace for any reg exp not allowed in such a box.
M
# What is wrong?
If there is an input box which is number only, you can still paste other characters in.
# How to recreate error?
Go to operators and bring out an addition block or an "is it prime" block. Now open a text editor and write any character which should not be there, e.g. "two" or ",!"£$£$%^&*()" or so on, and copy this text and paste into the block.
Is it prime does indeed return false for these, but given longer to play with one could find something which breaks a function more.
I initially found the error by pasting in a long number using a comma. (There is also the fact that in different cultures some people use ',' rather than '.' to separate integers and rational or irrational floors. (but rational as on a computer)
# Proposal for fixing it
You could see if you can strip characters when pasting. I know this is possible in other languages, but do not know GP well enough to test it. Essentially, when pasting, you save it as a temporary variable, and then you search and replace for any reg exp not allowed in such a box.
M