Refresh to remember position

I can't seem to find a setting to remember the scroll position and current item selection following a lister refresh. In fact, there should be options to say what to do if the last selected item is no longer present, such as select above, select below, select none. However, with the last selected item being present or not, the scroll position should still be retained as well as possible.

-Andreas

Install below script

Then run the command
GoEx REFRESHKEEPSEL MAKEVISIBLE

Edit:
If you replace your existing refresh button with GoEx command you might want to use this instead.

@if:Prefs SCRIPTDISABLE="Command.Generic_GoEx.js,enable"
GoEx REFRESHKEEPSEL MAKEVISIBLE
@if:else
Go REFRESH=source

This allows the original refresh to still work if the GoEx script is disabled.

One thing to point out is the actual scroll position isn't saved and restored upon refreshing. All it's doing is scrolling to the first selected item after a refresh.

1 Like

Yes, in day to day usage though, scrolling to the selection seems to work good enough. Some years have past since the "invention" of GoEx, we can probably get the entry in focus by now and restore scroll position to that, which was not possible back then if I remember correctly.

Honestly, I kind wonder, why there is no native implementation of "restore scroll position and selection" yet? @Leo and @Jon, do we all use GoEx or what is the reason for this? To me this is a very basic functionality, don't you feel abused yourself, whenever your folder content refreshes and scroll position and selection is gone? Do we miss anything in that regard? o))

I basically don't notice the lack of a native implementation (mostly!), because I have GoEx placed into all the buttons and shortcuts. So, I can say, it still works quite well. The question about why this GoEx thing is still necessary seems to remain though?!

Thanks! o)

EDIT: No offense, I see you Leo and Jon write lots of code. I read through the latest change log an hour ago and was thinking: Nice, thank you, please keep it going, it's so awesome! o))

1 Like

Are you talking about when you press F5?

The scroll position and selection are remembered by default when refreshing via the Go REFRESH command.

I guess so, but it does not work for me. I assume it never did, that's why I felt the need to write this GoEx script addin?

I just tried again with "Go REFRESH" to make sure, nope..
Scrolled down some pages, selected some files, run Go REFRESH via button and the file display will move to the top and not have anything selected.

It always felt odd to me, but could it be I just missed a setting all these years? I had a quick look for "first" and "refresh", but no setting seems related. Maybe you have another idea? Mhh..

Try turning this on:

Preferences / File Displays / Folder Expansion / Remember expanded folders when refreshing

As well as keeping expanded folders expanded, that also causes the selections and scroll position to be preserved when refreshing.

Thank you! Quick test.. it seems to work (even I don't use the folder expansion icons).

The expanded folders are new with v13, so is it possible that until v13, there was a real need for GoEx? Or put differently, a need for something to restore selection and focus and run some form of SELECT MAKEVISIBLE to get a proper "refresh experience"?!

I am happy to let go of GoEx REFRESH, if this is native functionality by now. Maybe it needs another checkbox in the preferences, because nobody draws the line between "expanded folders"!? The setting you pointed me to, it was set to "false" / off? Not sure if this is the default, if it is, it makes sense to enable if for all? I guess 99% of users would like they things restored when refreshing. Just a guess of course! o)

Awesome progress, thank you! o)

Yeah, splitting things out into more granular options probably makes sense.

(Personally, I like being able to push F5 and reset everything to how it would look if I had just gone into the folder for the first time, so I keep that option off. But I can certainly see cases for wanting some or all of the three things to be preserved.)

Oh yes, there is at least that issue where UNC paths mounted to local folders will not refresh automatically and will not show updates (occasionally). I have to F5, even after simple renames in these folders. We had a quick attempt to track this problem down back then, but never got to the bottom of it. Apart from that, doing the F5 refresh here and there is part of some kind of "peace of mind" procedure in general for me. I guess I used too many software with refresh issues. o)

Could you add a short statement about what v12 was capable of in terms of restoring position and selection? There were no "expanded folders", so all this restore scroll position and re-select is new in v13? Just in case you know about it, maybe it was Jon who did an "U-Boot Projekt" here.. o)
"U-Boot Projekt" we use at work sometimes, it translates to "sub marine project", which is something nobody is aware of.. o)

Why not have a quick refresh and a standard refresh whereby a quick refresh could be achieved by holding down a key suck as Ctrl as part of the F5? Quick refresh would then refresh without retaining the current position whilst normal refresh would.

Please note that the fact is that the position shouldn't just be remembered for refresh but for navigation as well. Not having the position remembered is slowing me down and is making me want to go back to File Explorer, it is that important foundational feature.

I use this script:

function OnClick(clickData) {
    var cmd = clickData.func.command;
    cmd.deselect = false;
    cmd.RunCommand('Go REFRESH=source');
    cmd.RunCommand('Select FROMSCRIPT SETFOCUS');
    cmd.RunCommand('Select SHOWFOCUS');
}

Was it an Aprils fool joke or did I read the change log correctly?

That "keep selection" and "remember scroll position" is a native thing now?

I can finally ditch my script I guess.. o)

Awesome! I will open a whisky! o)

I am keeping the one that preserves the quick filter :slight_smile:

You mean the current input on the quick filter bar at the bottom?

Go refresh=state
Seems to keep that as well for me, I did not switch to the native solution yet, but first tests seem to be very good.

The native command is is not quicker than my scripted solution:
GoEx REFRESHKEEPSEL MAKEVISIBLE=checked
Which does not speak for my script, but for the scripting API - I really mean it! o)

Yes.

Go REFRESH=state

will clear the quick filter, at least on my system.

This

Go REFRESH=state
=return IsChecked("Set QUICKFILTER") ? "Set QUICKFILTER=!prev" : ""

will re-enable it. Works just as well as my script, it seems.

There is a setting related to this if I remember correctly, so I am not sure you really need a script or evaluator to restore to the last used quick filter value?!

Is there? Might have missed it!

Preferences / Filtering and Sorting / Filter Bar / Clear the filter automatically when changing folders

Turning that off will mean the filter isn't cleared on refresh. Although you may still want it to be cleared when changing to other folders.

Maybe we should have separate options for refresh and actually changing to another folder, as I can see cases where you might want one but not the other. At the moment the option covers both.

1 Like

Ah yes, got it.

How about a flag like filter for Go REFRESH?

2 Likes

Could you please add one of your i information texts to that setting, so one finds this when searching for "refresh", e.g.? I know, that setting also contains "refresh", but since you quickly understand the semantic discrepancy between what you're looking for and what you're reading, you're quick to check the next search result, thus not finding anything.