diff --git a/app/src/processing/app/Sketch.java b/app/src/processing/app/Sketch.java index 7b18fc4d1..125bd0f52 100644 --- a/app/src/processing/app/Sketch.java +++ b/app/src/processing/app/Sketch.java @@ -70,6 +70,7 @@ public class Sketch { private SketchCode current; private int currentIndex; + /** * Number of sketchCode objects (tabs) in the current sketch. Note that this * will be the same as code.length, because the getCode() method returns @@ -83,28 +84,6 @@ public class Sketch { /** Moved out of Editor and into here for cleaner access. */ private boolean untitled; -// /** Class path determined during build. */ -// private String classPath; -// -// /** -// * This is *not* the "Processing" libraries path, this is the Java libraries -// * path, as in java.library.path=BlahBlah, which identifies search paths for -// * DLLs or JNILIBs. (It's Java's LD_LIBRARY_PATH, for you UNIX fans.) -// */ -// private String javaLibraryPath; -// -// /** -// * List of library folders, set up in the preprocess() method. -// */ -// private ArrayList importedLibraries; -// //private ArrayList importedLibraries; - - /** - * Most recent, default build path. This will contain the .java files that - * have been preprocessed, as well as any .class files that were compiled. - */ -// private File buildFolder; - /** * Used by the command-line version to create a sketch object. @@ -336,10 +315,10 @@ public class Sketch { // TODO maybe just popup a text area? renamingCode = true; String prompt = (currentIndex == 0) ? - Language.text("editor.sketch.rename.description") : Language.text("editor.tab.rename.description"); + Language.text("editor.sketch.rename.description") : + Language.text("editor.tab.rename.description"); String oldName = (current.isExtension(mode.getDefaultExtension())) ? current.getPrettyName() : current.getFileName(); - // editor.status.edit(prompt, oldName); promptForTabName(prompt + ":", oldName); } @@ -788,8 +767,10 @@ public class Sketch { if (!saveAs()) return false; } - for (int i = 0; i < codeCount; i++) { - if (code[i].isModified()) code[i].save(); + for (SketchCode sc : code) { + if (sc.isModified()) { + sc.save(); + } } calcModified(); return true; diff --git a/app/src/processing/app/Util.java b/app/src/processing/app/Util.java index 4317fb887..dd80e645a 100644 --- a/app/src/processing/app/Util.java +++ b/app/src/processing/app/Util.java @@ -148,7 +148,8 @@ public class Util { /** - * Grab the contents of a file as a string. + * Grab the contents of a file as a string. Connects lines with \n, + * even if the input file used \r\n. */ static public String loadFile(File file) throws IOException { String[] contents = PApplet.loadStrings(file); @@ -158,9 +159,15 @@ public class Util { /** - * Spew the contents of a String object out to a file. + * Spew the contents of a String object out to a file. As of 3.0 beta 2, + * this will replace and write \r\n for newlines on Windows. + * https://github.com/processing/processing/issues/3455 */ static public void saveFile(String str, File file) throws IOException { + if (Base.isWindows()) { + String[] lines = str.split("\\r?\\n"); + str = PApplet.join(lines, "\r\n"); + } File temp = File.createTempFile(file.getName(), null, file.getParentFile()); try { // fix from cjwant to prevent symlinks from being destroyed. @@ -185,7 +192,7 @@ public class Util { boolean result = file.delete(); if (!result) { throw new IOException("Could not remove old version of " + - file.getAbsolutePath()); + file.getAbsolutePath()); } } boolean result = temp.renameTo(file); diff --git a/core/todo.txt b/core/todo.txt index ab48a0973..832a0e752 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -6,6 +6,9 @@ X throw an error when using methods that require sketchPath outside setup() X https://github.com/processing/processing/issues/3433 X cursor(CROSS) breaks when using surface.setTitle() X https://github.com/processing/processing/issues/3472 +X Fix null pointer exception in setVertex +X https://github.com/processing/processing/pull/3553 +X https://github.com/processing/processing/issues/3550 fixed earlier X blend() and copy() are not pixel accurate for copy/scale @@ -16,6 +19,7 @@ andres/jakub X toggling between noLights and PointLight in draw() behaving strangely X https://github.com/processing/processing/issues/3546 +_ implement strip(), lstrip(), rstrip? docs _ note that full screen and present are now different