mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
add support for < and > is copyAsHTML (issue #351)
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user