Skip to content

Commit 0bceb93

Browse files
committed
When closing the last sketch, the window position is saved as default
This allows the use-case with users editing one sketch at a time, that seems to be the most common scenario: 1. User position the editor as desired 2. User close the IDE 3. User opens the IDE by double clicking on another .ino file 4. The IDE is opened again at the same position See #4432
1 parent 61f11f6 commit 0bceb93

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/src/processing/app/Base.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ public Base(String[] args) throws Exception {
327327
boolean showEditor = parser.isGuiMode();
328328
if (!parser.isForceSavePrefs())
329329
PreferencesData.setDoSave(showEditor);
330-
if (handleOpen(file, nextEditorLocation(), showEditor, false) == null) {
330+
if (handleOpen(file, retrieveSketchLocation(".default"), showEditor, false) == null) {
331331
String mess = I18n.format(tr("Failed to open sketch: \"{0}\""), path);
332332
// Open failure is fatal in upload/verify mode
333333
if (parser.isVerifyOrUploadMode())
@@ -528,7 +528,10 @@ protected void storeSketches() {
528528
PreferencesData.setInteger("last.screen.width", screen.width);
529529
PreferencesData.setInteger("last.screen.height", screen.height);
530530

531-
String untitledPath = untitledFolder.getAbsolutePath();
531+
// If there is only one sketch opened save his position as default
532+
if (editors.size() == 1) {
533+
storeSketchLocation(editors.get(0), ".default");
534+
}
532535

533536
// Save the sketch path and window placement for each open sketch
534537
String untitledPath = untitledFolder.getAbsolutePath();

0 commit comments

Comments
 (0)