From 707cbc40a2ad679a5b040cdb04780a55083c3364 Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Wed, 13 Apr 2022 20:48:49 +0200 Subject: Add Id field to Menu_Entry for consistent identification of entries across refreshes --- Script.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Script.c') diff --git a/Script.c b/Script.c index bc92b7d..5d2f5b6 100644 --- a/Script.c +++ b/Script.c @@ -1122,6 +1122,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; @@ -1133,6 +1135,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) @@ -1223,6 +1239,7 @@ Menu_Entry({ Callback = , AllowDisabledSelection = >Menu_Condition_Default< | Menu_Condition_AllowSelection | Menu_Condition_DenySelection }, + Id = Extra = >Also used internally<, XPar1 = >Also used internally<, XPar2 = >Also used internally<, -- cgit v1.2.3-54-g00ecf