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