PencilCode / pencilcode

An online IDE for kids: pencilcode.net.
http://dev.pencilcode.net/
MIT License
167 stars 100 forks source link

Custom Block Palette: inconsistent behavior about multi-line snippets #230

Open yanamal opened 8 years ago

yanamal commented 8 years ago

I was working on an online version of pencil cards, and wanted to have some multi-line snippets like: """ rt 45 fd 70 rt 90 fd """ (except I used \n for actual newlines and it wasn't a multiline string, i.e.: 'rt 45\nfd 70\nrt 90\nfd')

But inside the palette, only the first line shows up. I was confused, since I know there are multi-line snippets present in the regular palette. Experimentation suggests:

  1. Multi-line snippets are preserved if they represent a container statement, e.g. if, forever, functions, etc.
  2. Comments are stripped out even within those (I wanted comments like "# put useful stuff here"

Is there a way to make Pencil Code preserve my multi-line block snippets the way I want them?

yanamal commented 8 years ago

Update: the hacky solution that more or less works is to put parenteses around the entire thing, e.g. '(rt 45\nfd 70\nrt 90\nfd)', though it still looks weird.