mirror of
https://github.com/processing/processing4.git
synced 2026-02-18 21:05:36 +01:00
js mode: pjs directive regex fix, crash on cancel-need-save fix and more
This commit is contained in:
@@ -145,10 +145,14 @@ public class DirectivesEditor
|
||||
|
||||
/* remove framing */
|
||||
mm = mm.replaceAll("^\\/\\*\\s*@pjs","").replaceAll("\\s*\\*\\/\\s*$","");
|
||||
/* fix multiline nice formatting */
|
||||
mm = mm.replaceAll("[\\s]*([^;\\s\\n\\r]+)[\\s]*,[\\s]*[\\n\\r]+","$1,");
|
||||
/* fix multiline version without semicolons */
|
||||
mm = mm.replaceAll("([^;\\s\\n\\r]+)[\\s]*[\\n\\r]+","$1;");
|
||||
mm = mm.replaceAll("\n","").replaceAll("\r","");
|
||||
mm = mm.replaceAll("[\\s]*([^;\\s\\n\\r]+)[\\s]*[\\n\\r]+","$1;");
|
||||
mm = mm.replaceAll("\n"," ").replaceAll("\r"," ");
|
||||
|
||||
System.out.println(mm);
|
||||
|
||||
if ( clean )
|
||||
{
|
||||
m.appendReplacement(buffer, "");
|
||||
@@ -198,7 +202,14 @@ public class DirectivesEditor
|
||||
return;
|
||||
}
|
||||
|
||||
String key = pair[0].trim(), value = pair[1].trim();
|
||||
String key = pair[0].trim(),
|
||||
value = pair[1].trim();
|
||||
|
||||
// clean these, might have too much whitespace around commas
|
||||
if ( validKeys.indexOf(key) == FONT || validKeys.indexOf(key) == PRELOAD )
|
||||
{
|
||||
value = value.replaceAll("[\\s]*,[\\s]*", ",");
|
||||
}
|
||||
|
||||
if ( validKeys.indexOf(key) == -1 )
|
||||
{
|
||||
|
||||
@@ -351,10 +351,15 @@ public class JavaScriptEditor extends Editor
|
||||
*/
|
||||
public boolean handleExport ( boolean openFolder )
|
||||
{
|
||||
if (handleExportCheckModified())
|
||||
if ( !handleExportCheckModified() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
toolbar.activate(JavaScriptToolbar.EXPORT);
|
||||
try {
|
||||
try
|
||||
{
|
||||
boolean success = jsMode.handleExport(sketch);
|
||||
if ( success && openFolder )
|
||||
{
|
||||
|
||||
@@ -115,8 +115,8 @@ public class JavaScriptMode extends Mode
|
||||
File[] jModeExamples = new File[] {
|
||||
new File(jExamples, "Basics"),
|
||||
new File(jExamples, "Topics"),
|
||||
new File(jExamples, "3D"),
|
||||
new File(jExamples, "Books")
|
||||
new File(jExamples, "3D") /*,
|
||||
new File(jExamples, "Books")*/
|
||||
};
|
||||
|
||||
// merge them all
|
||||
|
||||
@@ -14,7 +14,6 @@ class JavaScriptServer implements HttpConstants, Runnable
|
||||
Thread thread = null;
|
||||
ServerSocket server = null;
|
||||
|
||||
// TODO: this needed? SocketException on stop coming from here?
|
||||
//private ArrayList<Worker> threads = new ArrayList<Worker>();
|
||||
//private int workers = 5;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user