I'm still having the following problem: when I'm programming a sketch, all changes are lost if the laptop goes into power-saving mode and I wake it up again.
For example, if I add a line of code and the laptop goes into power-saving mode after a while, the new line of code is gone when I wake the laptop up again. And this affects every changes to the sketch if I haven't saved it before the laptop goes into power-saving mode
It looks like the IDE is refreshing and undoing all the changes.
You are welcome. I'm glad if I was able to be of assistance.
I also prefer to have control over when my sketch is saved. But many people find the auto-save behavior to be convenient (it is a common feature across other IDEs and programming editors).
The alternative would be to just be vigilant about manually triggering a save anytime you will be leaving your computer unattended. Just as I like control over saving, I also like control over when my PC sleeps. So I actually have the auto-sleep behavior disabled on my computer and thus it is a natural sequence for me to save files before putting the machine to sleep. However, I understand that when working from battery power the auto-sleep might be more important in order to ensure you don't drain your battery if you ended up going AFK without remembering to manually trigger a sleep.
If you are using a windows computer, sleep is anyway not a the best method to preserve the battery. Use Hibernate instead. All of the memory will be temporarily stored on the HD and the laptop will actually shut down and really stop using power. If on battery powered and your laptop goes into sleep, external devices connected to USB ports may not be shut down, and may drain your battery, while you may not even get an alert.