Skip to content

Unsaved changes lost after "**Save As...**" operationΒ #896

Closed
@per1234

Description

@per1234

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

  1. Select File > Preferences from the Arduino IDE menus.
  2. Uncheck the box next to "☐ Auto save"
  3. Click the OK button.
  4. 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.
  5. Make some change to the sketch.
    ❗ Do not save.
  6. Select File > Save As... from the Arduino IDE menus.
  7. 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)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions