mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 03:07:56 +01:00
Fixing merge issues
This commit is contained in:
1
.github/actions/spell-check/expect.txt
vendored
1
.github/actions/spell-check/expect.txt
vendored
@@ -1221,6 +1221,7 @@ opensource
|
||||
openxmlformats
|
||||
ollama
|
||||
onnx
|
||||
openurl
|
||||
OPTIMIZEFORINVOKE
|
||||
ORPHANEDDIALOGTITLE
|
||||
ORSCANS
|
||||
|
||||
@@ -162,11 +162,19 @@ public partial class MainListPage : DynamicListPage,
|
||||
}
|
||||
else
|
||||
{
|
||||
var validScoredFallbacks = _scoredFallbackItems?
|
||||
.Where(s => !string.IsNullOrWhiteSpace(s.Item.Title))
|
||||
.ToList();
|
||||
|
||||
var validFallbacks = _fallbackItems?
|
||||
.Where(s => !string.IsNullOrWhiteSpace(s.Item.Title))
|
||||
.ToList();
|
||||
|
||||
return MainListPageResultFactory.Create(
|
||||
_filteredItems,
|
||||
_scoredFallbackItems?.ToList(),
|
||||
validScoredFallbacks,
|
||||
_filteredApps,
|
||||
_fallbackItems?.ToList(),
|
||||
validFallbacks,
|
||||
_appResultLimit);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,22 +30,17 @@ internal static class MainListPageResultFactory
|
||||
|
||||
int len1 = filteredItems?.Count ?? 0;
|
||||
|
||||
// Scored or not, fallbacks may contain empty items that we want to skip.
|
||||
int len2 = GetNonEmptyFallbackItemsCount(scoredFallbackItems);
|
||||
// Empty fallbacks are removed prior to this merge.
|
||||
int len2 = scoredFallbackItems?.Count ?? 0;
|
||||
|
||||
// Apps are pre-sorted, so we just need to take the top N, limited by appResultLimit.
|
||||
int len3 = Math.Min(filteredApps?.Count ?? 0, appResultLimit);
|
||||
|
||||
int nonEmptyFallbackCount = GetNonEmptyFallbackItemsCount(fallbackItems);
|
||||
int nonEmptyFallbackCount = fallbackItems?.Count ?? 0;
|
||||
|
||||
// Allocate the exact size of the result array.
|
||||
int totalCount = len1 + len2 + len3 + nonEmptyFallbackCount;
|
||||
|
||||
// If there are non-empty fallbacks, we'll be adding a separator "Section"
|
||||
if (nonEmptyFallbackCount > 0)
|
||||
{
|
||||
totalCount++;
|
||||
}
|
||||
// We'll add an extra slot for the fallbacks section header if needed.
|
||||
int totalCount = len1 + len2 + len3 + nonEmptyFallbackCount + (nonEmptyFallbackCount > 0 ? 1 : 0);
|
||||
|
||||
var result = new IListItem[totalCount];
|
||||
|
||||
@@ -134,7 +129,10 @@ internal static class MainListPageResultFactory
|
||||
if (fallbackItems is not null)
|
||||
{
|
||||
// Create the fallbacks section header
|
||||
result[writePos++] = new Separator(Properties.Resources.fallbacks);
|
||||
if (fallbackItems.Count > 0)
|
||||
{
|
||||
result[writePos++] = new Separator(Properties.Resources.fallbacks);
|
||||
}
|
||||
|
||||
for (int i = 0; i < fallbackItems.Count; i++)
|
||||
{
|
||||
|
||||
@@ -96,7 +96,7 @@ public partial class MainListPageResultFactoryTests
|
||||
var titles = result.Select(r => r.Title).ToArray();
|
||||
#pragma warning disable CA1861 // Avoid constant arrays as arguments
|
||||
CollectionAssert.AreEqual(
|
||||
new[] { "F1", "SF1", "A1", "SF2", "A2", "F2", "FB1", "FB2" },
|
||||
new[] { "F1", "SF1", "A1", "SF2", "A2", "F2", "Fallbacks", "FB1", "FB2" },
|
||||
titles);
|
||||
#pragma warning restore CA1861 // Avoid constant arrays as arguments
|
||||
}
|
||||
@@ -129,7 +129,6 @@ public partial class MainListPageResultFactoryTests
|
||||
var fallbacks = new List<Scored<IListItem>>
|
||||
{
|
||||
S("FB1", 0),
|
||||
S(string.Empty, 0),
|
||||
S("FB3", 0),
|
||||
};
|
||||
|
||||
@@ -140,9 +139,10 @@ public partial class MainListPageResultFactoryTests
|
||||
fallbacks,
|
||||
appResultLimit: 10);
|
||||
|
||||
Assert.AreEqual(2, result.Length);
|
||||
Assert.AreEqual("FB1", result[0].Title);
|
||||
Assert.AreEqual("FB3", result[1].Title);
|
||||
Assert.AreEqual(3, result.Length);
|
||||
Assert.AreEqual("Fallbacks", result[0].Title);
|
||||
Assert.AreEqual("FB1", result[1].Title);
|
||||
Assert.AreEqual("FB3", result[2].Title);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
||||
Reference in New Issue
Block a user