Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Are you sure you want to close the sketch?" message when doing "Save as" with dirty sketch #38

Closed
ubidefeo opened this issue Feb 25, 2021 · 1 comment
Assignees
Labels
conclusion: resolved Issue was resolved criticality: medium Of moderate impact priority: high Resolution is a high priority topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@ubidefeo
Copy link

ubidefeo commented Feb 25, 2021

Describe the bug

If a "Save As..." is done when the sketch is in an unsaved (AKA "dirty") state, the IDE presents an unexpected "Are you sure you want to close the sketch?" dialog.

Regardless of which choice the user selects in the dialog, the resulting sketch files do not contain the unsaved changes that were in the editor.

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.
  5. Make some change to the sketch and do not save.
  6. Select File > Save As... from the Arduino IDE menus.
  7. Click the Save button.
    An "Are you sure you want to close the sketch?" message is shown unexpectedly, since you did not do anything that would be considered a close operation.
  8. Click the Yes button.
    The IDE window now closes.
  9. Open the sketch you saved via the "Save As..." operation.
  10. Check whether the change you made is present.
    It is not!
  11. Select File > Save As... from the Arduino IDE menus.
  12. Click the Save button.
    An "Are you sure you want to close the sketch?" message is shown unexpectedly, since you did not do anything that would be considered a close operation.
  13. Click the No button.
  14. Open the sketch you saved via the "Save As..." operation.
  15. Check whether the change you made is present.
    It is not!

Expected behavior

The exact contents of the sketch that is open in the editor are always saved to the sketch specified via the "Save As..." operation, regardless of dirty state.

No "Are you sure you want to close the sketch?" dialog is shown during this procedure.

The currently open sketch is replaced by the new sketch created by the "Save As..." process, just as it does after "Save As..." with a non-dirty sketch.

Desktop

  • OS: Windows 10
  • Version: 2.0.0-rc1-snapshot.be55a0a
    Date: 2021-12-03T11:09:57.266Z
    CLI Version: 0.20.1 [abb21449]

Additional context

[ originally reported by @per1234 ]

@ubidefeo ubidefeo added type: bug priority: medium Resolution is a medium priority labels Feb 25, 2021
@cmaglie cmaglie removed the type: bug label Sep 16, 2021
@rsora rsora added the type: imperfection Perceived defect in any part of project label Sep 22, 2021
@per1234 per1234 added the topic: code Related to content of the project itself label Oct 29, 2021
@rsora rsora added criticality: medium Of moderate impact and removed priority: medium Resolution is a medium priority labels Nov 2, 2021
@ubidefeo ubidefeo added the priority: high Resolution is a high priority label Jan 25, 2022
@per1234
Copy link
Contributor

per1234 commented Mar 10, 2022

The "unexpected close" bug that was the primary focus of this issue was fixed by #791, but the fix was not very visible until #880 due to a different "Save As..."-related regression introduced by #791.

The "loss of unsaved changes" bug is still not resolved, but will be tracked in a dedicated issue at #896

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved criticality: medium Of moderate impact priority: high Resolution is a high priority topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

5 participants