summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Script.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Script.c b/Script.c
index e9b791e..82a1905 100644
--- a/Script.c
+++ b/Script.c
@@ -1089,6 +1089,8 @@ func Refresh(array selection, bool delayed)
var oldNoSelectionCallbacks = noSelectionCallbacks;
noSelectionCallbacks = true;
+ var oldSelectionId = columnEntries[selection[1]]?[selection[0]]?.Id;
+
CloseMenu(settings.Object);
var oldRefreshing = refreshing;
@@ -1100,6 +1102,20 @@ func Refresh(array selection, bool delayed)
if(GetLength(columnEntries[column]) > 0)
{
+ if (oldSelectionId != nil)
+ {
+ var i = 0;
+ for (var entry in columnEntries[column])
+ {
+ if (entry.Id == oldSelectionId)
+ {
+ selection = i;
+ break;
+ }
+ ++i;
+ }
+ }
+
SelectEntry(BoundBy(selection, 0, GetLength(columnEntries[column]) - 1), column);
if(settings.InstantDescription.Enable)
@@ -1184,6 +1200,7 @@ Menu_Entry({
Callback = <Callback>,
AllowDisabledSelection = >Menu_Condition_Default< | Menu_Condition_AllowSelection | Menu_Condition_DenySelection
},
+ Id = <Can be set to any unique non-nil value to re-identify entries on refreshing/reopening>
Extra = <Same as extra of AddMenuItem> >Also used internally<,
XPar1 = <Same as XPar1 of AddMenuItem> >Also used internally<,
XPar2 = <Same as XPar2 of AddMenuItem> >Also used internally<,