Skip to content

Commit 950d88d

Browse files
committed
Handle unsaved tab deletion correctly
1 parent f8540b3 commit 950d88d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

app/src/processing/app/SketchController.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,21 @@ public void handleDeleteCode() throws IOException {
253253
sketch.delete();
254254
editor.base.handleClose(editor);
255255
} else {
256+
257+
boolean neverSavedTab = !current.fileExists();
258+
256259
// delete the file
257-
if (!current.delete(sketch.getBuildPath().toPath())) {
260+
if (!current.delete(sketch.getBuildPath().toPath()) && !neverSavedTab) {
258261
Base.showMessage(tr("Couldn't do it"),
259262
I18n.format(tr("Could not delete \"{0}\"."), current.getFileName()));
260263
return;
261264
}
262265

266+
if (neverSavedTab) {
267+
// remove the file from the sketch list
268+
sketch.removeFile(current);
269+
}
270+
263271
editor.removeTab(current);
264272

265273
// just set current tab to the main tab

0 commit comments

Comments
 (0)