78.0.3904.108 (Official Build) (64-bit) (cohort: Stable)
I can't reproduce this.
I have also seen this error. Are the lines temporarily fixed when you edit the options?
It only happens sometimes.
so you sometimes open the xml files with another text editor?
No, I just save the projects to my account, then open them again with Snap! Then the newlines in the dropdown inputs in the custom blocks are replaced by spaces.
Your issue is the same. Break lines inside input options, and also inside the default input value.
But I can't reproduce it. Our format functions (trimming, escaping...) are working fine, and your xml must have
The question is, how have these breakLines been introduced? I can't (yes, editing the xml file and pushing the project to the cloud... but I guess this is not the case).
Then, do you (both) remember if you did "drag and drop" for those options? Maybe some strange character (returnCarriage or other control chars) were there... If we can reproduce the creation event (the original text written inside the editor), we will improve our xml format function
This also happens to me and I absolutely hate it with a passion. This seems to happen both when saving and exporting things. It even happened to my XML Generator, making it entirely unusable! This even happens to my comments. I have absolutely no idea why this happens but for variable names, just clicking it and hitting Apply seems to fix it, and for comments and other things, typing a space or other random character fixes all the newlines. This is a pain however as its happened to all of my comments and all of my parameters and it is extremely frustrating to fix. Can you please debug this? Thank you. It is extremely important as many of my projects have become completely unusable for the time being! If you want a quick fix I suggest just adding and removing a space to every field that is loaded or just calling whatever update function this is when it loads.
This bug is very destructive and can ruin projects very easily because complex projects would need someone to go through every single instance of a newline and update the text to repair these issues. Thankfully, it is not a permanent replacement at least, meaning the projects are still easily repaired, but still rather tedious and hard to find all occurrences of.
On a side note, some of the notes for some of my projects seem to have disappeared but I filled them back out.
Maybe there could also be some sort of magic button to update all of the text data because some of my more complicated projects I can't seem to fix because it's giving me all kinds of errors and all the option fields are improper.
I'm sorry but I cannot reproduce this bug in any of my browsers or OSes. I've seen it in one or two cases when we were giving workshops, so I know it happens, but I can't reproduce it.
You've pushed one of my buttons; I always tell students "debug by subtraction, not by addition." That is, find the offending code and remove it, rather than adding a workaround. With the latter technique you eventually end up putting bandaids on the bandaids. I'm sure you know this but, in the immortal words of Stan Freberg, remember the tiny tots [reading this].
The workaround is really only a temporary solution until an official solution is in place because I feel like this might be easier to just add and remove at least so i can be able to use my projects until eventually a final solution is in place. This appears to be something with just loading the text though because if it fixes itself when i make any changes then it is stored correctly, just not loaded correctly. This occurs on firefox and chrome but i believe i saved changes on firefox. This is a very strange issue if the editor knows it exists but only after it has been updated.
Also, I spent a long time updating my XML project to fix those bugs so sorry if you were looking at that. It is a public project and I can't find many other occurrences that I haven't already fixed, but it is still a pain.
@wunder_wulfe , I also can't reproduce this issue.
Have you a "certain sequence of steps" that always reproduces this issue, or does it only happen sometimes?
I am not sure at all what causes it but it just decides to save or export that way and sometimes it does not. If I happen to export something that has an issue I will send the xml here. You can also check the loading and edit functions and see why it fixes only on change.
Here, try checking the comment in Set XML Attribute in this Block Export. I'm trying to make it happen to
options but I don't know what triggers it. Selecting everything in the comments and doing a string comparison says it is the same thing, so it is just not registering the newlines as being actual newlines.
Found the error I believe. Someone is not correctly escaping/encoding or parsing newlines.
Make 100% sure that your function is correctly escaping all line breaks!!
And also make 100% sure that if you are reading an XML file with line breaks like these, that when you copy the text over, you update them to use the correct line break character beforehand (
) instead of only when they type something in.
also seems like a carriage return
\r which is kind of interesting that it isn't
\n), but both need to be handled!
Also, it appears that this character is a carriage return that was improperly handled?
This appears to be an oversight issue so hopefully it should be rather easy to fix, but I am not really sure how nobody has spotted this yet.
and I'm sorry about this issue and I'll try to see it again (checking all our format functions (trimming, escaping...) , but you know this is not new (see our last November posts and the problem is not the XML (yes, we already saw then the problem of the returnCarriage or other control charst). The problem is what is their origin... I am not yet able to reproduce it.
What I mean is we can improve our functions, but maybe the cause is not Snap!
Because if somebody import a project modified by a text editor (maybe with unconscious changes, because that editor makes automatic changes on codification or indentation ...) or somebody drag and drop text from outside...
Then, we cannot control every possible scenario.
Codification changes (utf-8, iso..), strange characters... See for example this issue caused by a drag and drop action.
I continue, but if anybody could report som reproducible example (steps to cause the problem), and we can confirm it is not caused by a XML edition or a drag and drop action... it will help a lot.
It is very odd because I can't remember doing anything at all to my project aside from export and import XML into it, but once it infects the project, it will infect all other things inside of it when it is saved or exported. Maybe it randomly happens only when I don't want it to happen so I will try and break it on purpose and see how I could potentially poison inputs.