diff --git a/app/src/processing/app/syntax/JEditTextArea.java b/app/src/processing/app/syntax/JEditTextArea.java index 0a0637f18..078ac0889 100644 --- a/app/src/processing/app/syntax/JEditTextArea.java +++ b/app/src/processing/app/syntax/JEditTextArea.java @@ -1621,6 +1621,7 @@ public class JEditTextArea extends JComponent for (int j = 0; j < segmentCount; j++) { char c = segmentArray[j + segmentOffset]; cf = cf.append(c); + appendAsHTML(cf, c); } } else { // If syntax coloring is enabled, we have to do this @@ -1644,7 +1645,8 @@ public class JEditTextArea extends JComponent if (id == Token.END) { char c = segmentArray[segmentOffset + offset]; if (segmentOffset + offset < limit) { - cf.append(c); +// cf.append(c); + appendAsHTML(cf, c); } else { cf.append('\n'); } @@ -1679,6 +1681,22 @@ public class JEditTextArea extends JComponent } } } + + + /** + * Handle encoding HTML entities for lt, gt, and anything non-ASCII. + */ + private void appendAsHTML(StringBuffer buffer, char c) { + if (c == '<') { + buffer.append("<"); + } else if (c == '>') { + buffer.append("&rt;"); + } else if (c > 127) { + buffer.append("&#" + ((int) c) + ";"); // use unicode entity + } else { + buffer.append(c); // normal character + } + } /** diff --git a/core/todo.txt b/core/todo.txt index 3fa93581f..8f5e85857 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -6,6 +6,9 @@ X fix the behavior _ need to finish font changes wrt native fonts before any release _ right now not in a good place--default font will be bitmapped and ugly +_ bug in SVG parser for shorthand curves (T/t and S/s) +_ http://code.google.com/p/processing/issues/detail?id=350 + _ image resizing is ugly (just use java2d?) _ http://code.google.com/p/processing/issues/detail?id=332 diff --git a/todo.txt b/todo.txt index 3573818a1..a4517b3b5 100644 --- a/todo.txt +++ b/todo.txt @@ -5,6 +5,9 @@ X the open button on the toolbar is goofed up X http://code.google.com/p/processing/issues/detail?id=323 X changed how "Save As" works, now copies everything in the folder X but ignores applet, application.*, screen-* files/folders +X Edit > Copy as HTML doesn't properly encode < and > +X http://code.google.com/p/processing/issues/detail?id=351 +X also fixed unicode entities earlier X add warning message when not using a version of sun java w/ p5 on linux