Show folder names immediately and refresh stale index sizes without walking the whole drive.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-26 11:21:20 +02:00
parent 6fc7506eb7
commit e2916aef9c
88 changed files with 5373 additions and 544 deletions

View File

@@ -57,10 +57,12 @@ public class UiPreferencesStoreTests
var prefs = UiPreferencesStore.Parse(
[
"auto-index-removable=true",
"background-host-at-logon=true"
"background-host-at-logon=true",
"prefer-favorites-in-tree=true"
]);
Assert.True(prefs.AutoIndexRemovable);
Assert.True(prefs.BackgroundHostAtLogon);
Assert.True(prefs.PreferFavoritesInTree);
}
[Fact]
@@ -76,10 +78,32 @@ public class UiPreferencesStoreTests
Assert.False(prefs.AutoClearQueueWhenDone);
Assert.False(prefs.AutoIndexRemovable);
Assert.False(prefs.BackgroundHostAtLogon);
Assert.False(prefs.PreferFavoritesInTree);
Assert.True(prefs.BackgroundMaintenanceWhenIdle);
Assert.Equal(10, prefs.IdleMaintenanceMinutes);
Assert.True(prefs.IdleMaintenanceAcOnly);
Assert.Null(prefs.SevenZipPath);
Assert.Null(prefs.GitPath);
Assert.Null(prefs.FfmpegPath);
Assert.True(prefs.SessionTabs is null || prefs.SessionTabs.Count == 0);
Assert.True(prefs.FavoriteFolders is null || prefs.FavoriteFolders.Count == 0);
}
[Fact]
public void Parse_idle_maintenance_keys()
{
var prefs = UiPreferencesStore.Parse(
[
"background-maintenance-when-idle=false",
"idle-maintenance-minutes=30",
"idle-maintenance-ac-only=false"
]);
Assert.False(prefs.BackgroundMaintenanceWhenIdle);
Assert.Equal(30, prefs.IdleMaintenanceMinutes);
Assert.False(prefs.IdleMaintenanceAcOnly);
Assert.Equal(5, UiPreferencesStore.NormalizeIdleMinutes(4));
Assert.Equal(10, UiPreferencesStore.NormalizeIdleMinutes(10));
Assert.Equal(30, UiPreferencesStore.NormalizeIdleMinutes(90));
}
[Fact]
@@ -127,6 +151,22 @@ public class UiPreferencesStoreTests
Assert.True(prefs.SessionTabs[1].ActiveIsRight);
}
[Fact]
public void Parse_reads_favorite_folders_and_skips_virtual_roots()
{
var prefs = UiPreferencesStore.Parse(
[
"favorite=D:\\Photos",
"favorite=D:\\Photos",
"favorite=This PC",
"favorite=C:\\Users\\Dominique\\Documents"
]);
Assert.NotNull(prefs.FavoriteFolders);
Assert.Equal(2, prefs.FavoriteFolders.Count);
Assert.Equal(@"D:\Photos", prefs.FavoriteFolders[0]);
Assert.Equal(@"C:\Users\Dominique\Documents", prefs.FavoriteFolders[1]);
}
[Fact]
public void Session_tab_roundtrip_escapes_semicolons_in_paths()
{
@@ -153,11 +193,13 @@ public class UiPreferencesStoreTests
WindowWidth: 1100,
WindowHeight: 720,
TreeWidth: 300,
FavoriteFolders: [@"D:\Photos", @"C:\Users\Dominique\Documents"],
SessionTabs:
[
new SessionTabState(@"C:\Temp", @"D:\", true, 0.6, true)
],
SessionActiveTab: 0));
SessionActiveTab: 0,
PreferFavoritesInTree: true));
var loaded = store.Load();
Assert.Equal("Light", loaded.Theme);
Assert.True(loaded.GroupNetworkPlaces);
@@ -168,9 +210,14 @@ public class UiPreferencesStoreTests
Assert.True(loaded.AutoClearQueueWhenDone);
Assert.False(loaded.AutoIndexRemovable);
Assert.False(loaded.BackgroundHostAtLogon);
Assert.True(loaded.PreferFavoritesInTree);
Assert.True(loaded.BackgroundMaintenanceWhenIdle);
Assert.Equal(10, loaded.IdleMaintenanceMinutes);
Assert.True(loaded.IdleMaintenanceAcOnly);
Assert.Equal(1100, loaded.WindowWidth);
Assert.Equal(720, loaded.WindowHeight);
Assert.Equal(300, loaded.TreeWidth);
Assert.Equal([@"D:\Photos", @"C:\Users\Dominique\Documents"], loaded.FavoriteFolders);
Assert.NotNull(loaded.SessionTabs);
var tab = Assert.Single(loaded.SessionTabs);
Assert.Equal(@"C:\Temp", tab.LeftPath);