Closed izadmin closed 9 years ago
The problem is that after a DPI change, the current buffer will have rendering errors unless it is reloaded. By default atom-hidpi closes the current buffer and reopens it. On my computer (also linux, running gnome-shell) if there are changes atom asks me if I would like to save them before reopening the file. If you are not seeing that prompt then there is definitely a problem. What desktop environment / window manager are you using?
I've been thinking for awhile that closing and reopening files (even when it properly asks you to save changes) is not a good default because data can be lost if the user accidentally clicks "No" when it asks "FILE_NAME has changes, would you like to save them?". I think I will disable the reopening feature by default and users who understand the risks can re-enable it.
It would also reduce the frequency of this problem if atom-hidpi only reopened the current file when the scale-factor actually changes.
Ideally I find a way to fix the rendering issues without reopening the current file, but so far I have not found any other solutions.
Hi!
I'm using KDE with the default (Kwin) window manager. I don't get a prompt of any kind.
The 'only reopen on scale-factor change' would definitely solve it for me. My scale factor almost never changes after I've started editing... I basically have two modes, plugged into monitor or only on laptop screen - so by the time I open Atom, I'm already in whatever mode I'm trying to be in about 98% of the time.
I'm the author of minimap-autohide... so I've done a bit of atom plugin coding. Maybe there's a way to trigger the screen-refresh without closing the buffer. You can do that with CTRL-ALT-R... and from the command palette you can use 'window:reload' - and a reload will keep unsaved changes...... So perhaps when scale-factor changes you can trigger that using atom.commands.dispatch or something?
Let me know if I can help in any way!
I have actually already tried that. When I trigger the reload, it prompts me to save any changes. If there are multiple files with changes, it prompts me to save all of them. I chose to just reopen the current file because then you only need to deal with one prompt.
I am going to assume KDE is a special case. I am currently installing it and I will investigate further. For now, release c07bce029469544215e1469e39c455ad7e7be876 disables the reopen feature by default and adds 'only reopen on scale-factor change'. Let me know if there are any problems. I am going to close this issue and open another one for a better fix for the rendering errors.
I can confirm that the update you pushed solves the problem for resize for me.
I think I just figured out why I don't get a prompt... and it is not kwin. I am also using the save-session plugin. If I have both save-session and hidpi enabled, I don't get a prompt and my changes are lost. if I disable save-session, but leave HiDPI enabled, I get the save changes prompt just as you described.
I'd guess that save-session disables the prompt in favor of it's own handling of the window close... but since you don't close the window, the changes simply get lost. (That's just a guess, not based on code digging)
anyway - Wanted to let you know since it doesn't appear to be a KDE issue after all.
Thats good to know. Thanks for investigating.
Using Atom 0.207.0 and higher at least, on linux.
How to reproduce:
With the hidpi plugin enabled, I open a file and type some edits into it. (In my case, I'm editing js / html files) Then resize the window.
Expected result: Bigger window, same files open exactly as before.
Actual result: Bigger window, same files open, but all unsaved changes are gone.