Newlines are replaced by spaces

Please fill out these questions for all feature requests and bug reports. If you're requesting a feature, please let us know why this feature is important or useful, not just what it should do.

  1. What browsers show this problem? Google Chrome
  2. Please share an example project (if possible).
    The dropdown menus had options on different lines when the project was saved.
  3. Describes the steps to reproduce this issue.
    Save a project with custom blocks with dropdown menus with multiple lines.
  4. What does Snap! currently do?
    When you open the project again, the options are all on one line.
  5. What should Snap! do instead?
    Have different options even when the project is loaded again.

Which version of Chrome are you running?

I think the latest version.

go to 'chrome://version' to check :wink:

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?

All of the newline characters, including the ones in the Javascript function block, and the options in the custom block, are replaced by spaces.

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.

which OS?

Windows 10

Hi @donotforgetmycode_sn, and also @snapenilk ,

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.


XML Generator

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.