Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<NuGetAuditMode>direct</NuGetAuditMode>
<PlatformTarget>$(Platform)</PlatformTarget>
<LocalCmdPalToolkit>$(MSBuildThisFileDirectory)..\PowerToys\src\modules\cmdpal\extensionsdk\Microsoft.CommandPalette.Extensions.Toolkit\Microsoft.CommandPalette.Extensions.Toolkit.csproj</LocalCmdPalToolkit>
<EnableWindowsTargeting>true</EnableWindowsTargeting>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove the global Windows-targeting opt-in

On non-Windows machines, this opts every project—including the MSIX host, Run plugin, and tests—into Windows targeting, even though the repository limits Linux validation to Core/Suggest with -p:EnableWindowsTargeting=true. It also modifies a protected build file outside the scope of this display-allocation optimization; remove the property and pass it only on the supported Core/Suggest build command.

AGENTS.md reference: AGENTS.md:L128-L129

Useful? React with 👍 / 👎.

<!-- NuGet by default. Opt in to local PowerToys SDK only via -p:UseLocalCmdPalSdk=true (deploy.ps1). -->
<UseLocalCmdPalSdk Condition="'$(UseLocalCmdPalSdk)' == ''">false</UseLocalCmdPalSdk>
</PropertyGroup>
Expand Down
47 changes: 43 additions & 4 deletions QuickShell.Core/Services/ShortcutDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,49 @@ private static bool AnyLaunchHasCommand(IEnumerable<WorkspaceEntry> launches) =>

private static string ShortenPath(string path) => ShortenPathForDisplay(path);

private static string CollapseToSingleLine(string? value) =>
string.Join(
' ',
(value ?? string.Empty).Split(['\r', '\n', '\t'], StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries));
private static string CollapseToSingleLine(string? value)
{
if (string.IsNullOrWhiteSpace(value))
{
return string.Empty;
}

var span = value.AsSpan();
if (span.IndexOfAny('\r', '\n', '\t') < 0)
{
return value.Trim();
}

// Bolt: Performance optimization - avoid string.Split() allocations; scan separators directly over the span.
var builder = new System.Text.StringBuilder(span.Length);
var first = true;
var segmentStart = 0;

for (var i = 0; i <= span.Length; i++)
{
var atEnd = i == span.Length;
if (!atEnd && span[i] != '\r' && span[i] != '\n' && span[i] != '\t')
{
continue;
}

var part = span[segmentStart..i].Trim();
if (!part.IsEmpty)
{
if (!first)
{
builder.Append(' ');
}

builder.Append(part);
first = false;
}

segmentStart = i + 1;
}

return builder.ToString();
}

private static string Truncate(string value, int maximumLength) =>
value.Length <= maximumLength ? value : value[..(maximumLength - 1)] + "…";
Expand Down
Loading