Fix the fucking first and last index selection logic
This commit is contained in:
@@ -19,20 +19,25 @@ namespace DD2Switcher {
|
||||
public static void UntrackWindow(int index) {
|
||||
if (index >= 0 && index < NumProc) {
|
||||
windows[index] = null;
|
||||
// Compact the array by shifting non-null elements to the left
|
||||
for (int i = index; i < NumProc - 1; i++) {
|
||||
windows[i] = windows[i + 1];
|
||||
}
|
||||
windows[NumProc - 1] = null;
|
||||
|
||||
// Update ActiveIndex if needed
|
||||
if (ActiveIndex == index) {
|
||||
ActiveIndex = -1;
|
||||
} else if (ActiveIndex > index) {
|
||||
ActiveIndex--;
|
||||
}
|
||||
|
||||
// Update first/last indices if needed
|
||||
if (FirstIndex == index) {
|
||||
FirstIndex = -1;
|
||||
}
|
||||
if (LastIndex == index) {
|
||||
LastIndex = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Static properties for first/last selection persistence
|
||||
public static int FirstIndex { get; set; } = -1;
|
||||
public static int LastIndex { get; set; } = -1;
|
||||
private static int ActiveIndex = -1;
|
||||
private static bool AltPressed = false;
|
||||
|
||||
|
Reference in New Issue
Block a user