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
Backup is broken in several ways with multiple instances #5449
Comments
May a developer please try to verify this? |
Thank you so much!! Precise and exhaustive report of all my confusion and suffering in this part of otherwise excellent Notepad++! |
Recently ran in to this issue myself and had a few thoughts on how this might be addressed. There is already support for multiple sessions as well as support for multiple instances. I really think that these should be combined, where launching a new instance, also creates a new session file. This could be taken one step further by making the backup functionality dependent on the session (i.e. each session has its own backup folder). A session file and its associated backup folder could persist until the last file in the session is manually closed. A simple dialog could be created to manage sessions or simply rely on the existing Load Session dialog. When launching NPP, if there is only one session that could automatically be opened and perhaps the idea of a permanent default session should be retained. However, if multiple sessions are detected, then a dialog could prompt which session(s) to open or to open all. To manage backup and snapshot settings a bit more sanely, settings for backup and session snapshots could potentially be added to session files, allowing the "global" behavior to be overridden when a sessions file is opened. |
this is an absolutely painful issue w the ever loved npp that eventually will come to bite any heavy user.. and depending on usage patterns, prior trust on npp auto backups, and luck, can sometimes be devastating .. As opposed to the complex suggestion by @dalgarin above, I propose that we pick a very simple strategy to solve the most pressing problem first.. that currently new instances start creating new files from 'new 1', 'new 2' etc, and the current backup strategy for unsaved files doesnt work well with having multiple unsaved files with the same name... .. so a simple solution for that, just keep a global cross-instance accounting of the highest new-file count actively in use, and just increment on that.. if nothing it can be done by creating a latest-new-file-name-counter file in app dir that just tracks whether we're at new file '7' or whatever, and any instances checks that file to create new file names .. sure it might mean that when new file for simple cleanup, on any instance start, if there are no backup files found, can reset the new counter to 0, or if there are any backup files, can set the counter to max of existing backup files etc.. prob also makes sense then to create a backup file when a named new file is created even when its empty (which think doesnt happen currently) (but honestly, prob just going with a random 8 char etc name for a new file is a lot cleaner/easier) I would do this myself, but my coding chops are in java/scala/go/web and not in windows/C .. would really appreciate if anyone pick this up. thanks! |
Fixed by b3a6638 |
Description of the Issue
When second, etc. instance is open, backup of files (and session) is either disabled or works incorrectly, without any warning for the user (even if this is an intended behavior).
Even the settings are altered when multiple instances are open!
The behavior is different for different ways of opening a new instance:
if the instance is open with Ctrl-F6, then any file (and the session) in this instance is not backed up, without any warning for the user.
if the instance is open with -multiInst, then it opens all files already open in the first instance (i.e., applies session restore), and if the user changes the contents of, say, new 1 in the first and independently in the second instance, only the last change gets backed up. Files opened only in one instance seem to be backed op normally.
if the instance is open with -multiInst -nosession, then no files are backed up, without any warning for the user.
In particular, this makes the mode -notabbar useless, because there is no way of giving the new file a name other than new 1, but with this name it will just overwrite the backup of the file new 1 in the other instance, while with -nosession the backup does not work at all.
Backup is a crucial feature nowadays when Windows tends to reboot each time when Microsoft fancies to reboot it without the user's consent.
Not tabbed interface is a crucial feature because it helps to separate different projects or just switch between files easier, as one switches between files in Word or Notepad, with all the benefits of Windows preview and consistent Windows interface.
Steps to Reproduce the Issue
Close all tabs; open NP++ (it opens a new tab "new 1"). Use Ctrl-F6 to open a new instances (it opens "new 1", so now you have two windows called "new 1"), open new tabs and/or files in new tabs in this new window, type or change something in each tab. No backup will be saved (while in the first window, backups work OK).
Open an NP++ instance; open another NP++ with -multiInst, then it opens all files already open in the previous instance (so now you have two windows with identical tabs, say, "new 1" and "new 1"). Type "hello world" in the tab "new 1" in the first instance. Type "hi here" in the tab "new 1" in the second instance. Check the backups: now only "hi here" is backed up, and "hello world" is lost. Now go to the first instance and change add an "!" after "world"; check the backup: now only "hello world!" is backed up and "hi there" is lost.
Open NP++ with -multiInst -nosession, type something, or open some files and change something. Check the backup: nothing is backed up. Go to bathroom; if Microsoft reboots your computer without your consent while you are there, all your work is lost.
I did not check this completely, but I observed that after some manipulations with -multiInst -nosession -notabbar, backups stopped working completely. When I opened Preferences, the checkbox "[_] backup files" was unexpectedly unchecked, though it was [X] checked before. Probably what I did was:
Expected Behavior
All instances should backup all files, and all windows should re-open at session restore -- like, say, Chrome or FireFox open all their windows and all their tabs as they were before crash/forced reboot.
Or, if by (bad) design some windows are not backed up, the user must be clearly warned about it, with each file which will not be backed up.
All settings should be changed only when the user changes them.
Actual Behavior
As described: files are not backed up, session is not restored for second etc. window, setting for "[X] backup files" is lost, so that as soon as Microsoft reboots your laptop while you are in the bathroom, you lose all your work.
The text was updated successfully, but these errors were encountered: