Closed
Description
Describe the bug
The IDE give the users the option of two save behaviors, configurable via File > Preferences > β Auto save:
- πΉ Auto save - changes to the sketch are saved to disk ~immediately
- β Auto save - changes to the sketch are stored in memory and saved to disk only when the user explicitly instructs the IDE to do so (e.g., File > Save)
π Unsaved changes are not written to disk when the user does a "Save As..." operation.
To Reproduce
- Select File > Preferences from the Arduino IDE menus.
- Uncheck the box next to "β Auto save"
- Click the OK button.
- Select File > New from the Arduino IDE menus.
βΉοΈ The bug is not limited to new sketches. It also occurs with sketches that have been previously saved to a permanent location on the disk. - Make some change to the sketch.
β Do not save. - Select File > Save As... from the Arduino IDE menus.
- Click the Save button.
π The changes you made are gone.
Expected behavior
Unsaved changes are saved to the target sketch during a "Save As..." operation.
Desktop
- OS: Windows 10, Ubuntu 20.04
- Version: 2.0.0-rc4-snapshot-70f1c5f
Date: 2022-03-09T10:47:19.505Z
CLI Version: 0.21.0 [10107d24]
Additional context
It is not a matter of the changes being saved to the wrong copy of the sketch. If you start from a previously saved sketch, the unsaved changes will not be in that one either.
This was originally reported at #38, but since the primary focus of that issue has since been resolved I decided it would be best to close #38 and track the remaining part in a dedicated issue.
Also reported at #829 (comment)