mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
don't remove old sketch name from Recent menu on Save As
This commit is contained in:
@@ -573,7 +573,7 @@ public class Sketch {
|
||||
code[i].setFolder(newFolder);
|
||||
}
|
||||
// Update internal state to reflect the new location
|
||||
updateInternal(sanitaryName, newFolder);
|
||||
updateInternal(sanitaryName, newFolder, renamingCode);
|
||||
|
||||
// File newMainFile = new File(newFolder, newName + ".pde");
|
||||
// String newMainFilePath = newMainFile.getAbsolutePath();
|
||||
@@ -985,15 +985,17 @@ public class Sketch {
|
||||
// While the old path to the main .pde is still set, remove the entry from
|
||||
// the Recent menu so that it's not sticking around after the rename.
|
||||
// If untitled, it won't be in the menu, so there's no point.
|
||||
if (!isUntitled()) {
|
||||
Recent.remove(editor);
|
||||
}
|
||||
// if (!isUntitled()) {
|
||||
// Recent.remove(editor);
|
||||
// }
|
||||
// Folks didn't like this behavior, so shutting it off
|
||||
// https://github.com/processing/processing/issues/5902
|
||||
|
||||
// save the main tab with its new name
|
||||
File newFile = new File(newFolder, newName + "." + mode.getDefaultExtension());
|
||||
code[0].saveAs(newFile);
|
||||
|
||||
updateInternal(newName, newFolder);
|
||||
updateInternal(newName, newFolder, false);
|
||||
|
||||
// Make sure that it's not an untitled sketch
|
||||
setUntitled(false);
|
||||
@@ -1191,7 +1193,8 @@ public class Sketch {
|
||||
/**
|
||||
* Update internal state for new sketch name or folder location.
|
||||
*/
|
||||
protected void updateInternal(String sketchName, File sketchFolder) {
|
||||
protected void updateInternal(String sketchName, File sketchFolder,
|
||||
boolean renaming) {
|
||||
// reset all the state information for the sketch object
|
||||
String oldPath = getMainFilePath();
|
||||
primaryFile = code[0].getFile();
|
||||
@@ -1213,7 +1216,11 @@ public class Sketch {
|
||||
// System.out.println("modified is now " + modified);
|
||||
editor.updateTitle();
|
||||
editor.getBase().rebuildSketchbookMenus();
|
||||
Recent.rename(editor, oldPath);
|
||||
if (renaming) {
|
||||
// only update the Recent menu if it's a rename, not a Save As
|
||||
// https://github.com/processing/processing/issues/5902
|
||||
Recent.rename(editor, oldPath);
|
||||
}
|
||||
// editor.header.rebuild();
|
||||
}
|
||||
|
||||
|
||||
@@ -242,6 +242,8 @@ public class Recent {
|
||||
synchronized static public void remove(Editor editor) {
|
||||
int index = findRecord(editor.getSketch().getMainFilePath());
|
||||
if (index != -1) {
|
||||
System.out.println("removing " + editor.getSketch().getMainFilePath());
|
||||
new Exception().printStackTrace(System.out);
|
||||
records.remove(index);
|
||||
}
|
||||
}
|
||||
@@ -291,6 +293,7 @@ public class Recent {
|
||||
// If this sketch is already in the menu, remove it
|
||||
remove(editor);
|
||||
|
||||
// If the list is full, remove the first entry
|
||||
if (records.size() == Preferences.getInteger("recent.count")) {
|
||||
records.remove(0); // remove the first entry
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@ X don't unzip __MACOSX files with contribs
|
||||
X don't do library subfolders
|
||||
X show error when .properties file is missing from contribs
|
||||
X clean up a lot of bad temp file handling in the contrib manager
|
||||
X https://github.com/processing/processing/issues/5845
|
||||
X don't remove entries from Recent menu on Save As
|
||||
X https://github.com/processing/processing/issues/5902
|
||||
|
||||
after the JDK 11 update
|
||||
X use a new pref for the sketchbook folder location for 4.x
|
||||
|
||||
Reference in New Issue
Block a user