View Issue Details

IDProjectCategoryView StatusLast Update
0002564Double CommanderDefaultpublic2021-03-27 23:56
ReporterAasasd Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status newResolutionopen 
ProjectionnoneETAnone 
Platformx86_64OSMac OS XOS Version10.13.6
Product Version0.9.9Product Build2020/06/27 
Summary0002564: DC should save the current panel directories (window state) more often
DescriptionIt appears that the current location, i.e. the folders in the panels/tabs, are saved only when DC exits. But many people these days run the apps for days or weeks on end, without closing. Which means that, once DC or the OS crash for some reason, the restored locations are old, possibly very old—which is especially inconvenient if the user has multiple tabs open for various current activities.

I looked in the options but haven't found anything that allows saving the paths more often.

The proposed algorithm is that DC saves the panel directory paths every once in a while, when the user navigates to some directory (possibly paths are saved together with other configuration). Since the user might go through multiple directories, it doesn't make sense to save each time—instead, the ‘events’ should be grouped for some interval. Writing the small file once in a minute shouldn't be a problem these days, but since we're talking on the scale of days or weeks, the delay of e.g. five minutes should be alright too.

I.e.:

- after the user navigates to some directory, DC starts an internal timer for a few minutes, thus scheduling the saving;

- while the timer is running, further navigation doesn't restart it—i.e. after the defined delay, the paths will be saved regardless of whether the user keeps navigating;

- when the timer runs out, DC saves current directory paths for panels and tabs;

- after this, further navigation again starts the timer.

The saving operation shouldn't be tied to any other event, such as further navigation—meaning that after the defined interval, paths are saved unconditionally.

Preferably this isn't implemented as just saving every X minutes. If saving is done only after navigation, i/o is minimized—no writes occur when DC is running in the background for hours or days, without user activity.
Steps To Reproduce1. Navigate to some directories, perhaps in multiple tabs.

2. Force-kill DC, simulating a crash—without letting it save the current configuration.

3. Reopen DC and behold old paths in the panels.
Additional InformationDouble Commander
Version: 0.9.9 beta
Revision: 9478
Build date: 2020/06/27
Lazarus: 2.0.3.0-61194
FPC: 3.0.4
Platform: x86_64-Darwin-qt4
OS version: Mac OS X 10.13.6

Widgetset library: Qt 4.8.6, libQt4Pas 4.5.3


Presumably this occurs on all OSes, since afaik it's an internal behavior of DC.
TagsNo tags attached.
Fixed in Revision
Operating systemMacOSX
WidgetsetQt4
Architecture64-bit

Activities

Aasasd

2020-11-28 14:27

reporter   ~0003571

“The saving operation shouldn't be tied to any other event, such as further navigation—meaning that after the defined interval, paths are saved unconditionally” — meaning, shouldn't be tied to any other events after the timer starts. Some people would implement this feature as:

when the user changes the directory:
- if (current_time() - timer_start_time) >= 5 min: save the paths
- else: timer_start_time = current_time()

But that's a mistaken approach. If the user changes the directory and then only does file operations and walks away, the paths aren't saved. Basically it's the difference between pushing and polling.

Hopefully FreePascal allows for such background timers that trigger operations without requiring further checks for the timer state.

Skif_off

2020-11-28 16:09

reporter   ~0003573

> I looked in the options but haven't found anything that allows saving the paths more often.

One way exists, but manually: https://doublecmd.github.io/doc/en/cmds.html#cm_ConfigSaveSettings

funkymaster

2021-03-27 04:12

reporter   ~0003726

On Windows, it happens that if the folder have not been open for a minimum of time, the correct path/folder is not restored if you close and open DC.
Maybe its the same on Linux. I have not tested this until now.

What about saving the path every time a directory is entered?
I think this could be easily implemented and replace the current solution with a timer, or whatever triggers saving the path now.

Skif_off

2021-03-27 07:04

reporter   ~0003727

> What about saving the path every time a directory is entered?

Bad idea because it can happen too often. Also using event "new tab" or "close tab" as trigger will be bad with the same cause.

Timer <=5 min is too often: we can open 100500 tabs or none.

funkymaster

2021-03-27 23:56

reporter   ~0003730

Hmmm, ok.
But is the scenario realistic that all of the open directories in the tabs change the path at the same time?
If not, 100500 lines would not be written at once.
And how is the behaviour now?
If I assume that 100500 tabs are opened at the same time with different directories, how would the timer work then.
Would it be a randomised delay for every timer?

Issue History

Date Modified Username Field Change
2020-11-28 14:10 Aasasd New Issue
2020-11-28 14:27 Aasasd Note Added: 0003571
2020-11-28 16:09 Skif_off Note Added: 0003573
2021-03-27 04:12 funkymaster Note Added: 0003726
2021-03-27 07:04 Skif_off Note Added: 0003727
2021-03-27 23:56 funkymaster Note Added: 0003730