Skip to content

Commit 7b5b01a

Browse files
committed
Fix textviewer highlighting
1 parent b80c264 commit 7b5b01a

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

QuickLook.Plugin/QuickLook.Plugin.TextViewer/Plugin.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ private HighlightingManager getHighlightingManager(Themes theme, string dirName)
128128
if (!Directory.Exists(syntaxPath))
129129
return hlm;
130130

131-
foreach (var file in Directory.EnumerateFiles(syntaxPath, "*.xshd"))
131+
foreach (var file in Directory.EnumerateFiles(syntaxPath, "*.xshd").OrderBy(f => f))
132132
{
133133
Debug.WriteLine(file);
134134
var ext = Path.GetFileNameWithoutExtension(file);
@@ -146,7 +146,8 @@ private HighlightingManager getHighlightingManager(Themes theme, string dirName)
146146
}
147147
private void AssignHighlightingManager(TextViewerPanel tvp, ContextObject context)
148148
{
149-
var isDark = (context.Theme == Themes.Dark) | OSThemeHelper.AppsUseDarkTheme() | false;
149+
var darkThemeAllowed = SettingHelper.Get("AllowDarkTheme", false, "QuickLook.Plugin.TextViewer");
150+
var isDark = darkThemeAllowed && OSThemeHelper.AppsUseDarkTheme();
150151
tvp.HighlightingManager = isDark ? _hlmDark : _hlmLight;
151152
}
152153
}

QuickLook.Plugin/QuickLook.Plugin.TextViewer/QuickLook.Plugin.TextViewer.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
</ItemGroup>
9090
<ItemGroup>
9191
<Content Include="Syntax\**">
92-
<CopyToOutputDirectory>None</CopyToOutputDirectory>
92+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
9393
</Content>
9494
<None Include="app.config" />
9595
<None Include="packages.config" />

QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ public TextViewerPanel(string path, ContextObject context)
4545
{
4646
_context = context;
4747

48-
SetResourceReference(Control.ForegroundProperty, "WindowTextForeground");
49-
Background = Brushes.Transparent;
48+
Background = OSThemeHelper.AppsUseDarkTheme()
49+
? new SolidColorBrush(Color.FromArgb(150, 255, 255, 255))
50+
: Brushes.Transparent;
5051
FontSize = 14;
5152
ShowLineNumbers = true;
5253
WordWrap = true;

Scripts/pack-appx.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ if(-not (Test-Path env:CI))
2424
Update-Version("..\Build\Appx\AppxManifest.xml")
2525

2626
# generate resources
27-
$priExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\makepri.exe'
27+
$priExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86\makepri.exe'
2828
.$priExe new /pr ..\Build\Appx /cf ..\Build\priconfig.xml /of ..\Build\Appx\resources.pri
2929

3030
# packing
31-
$packExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\makeappx.exe'
31+
$packExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86\makeappx.exe'
3232
$folder = '..\Build\Appx\'
3333

3434
.$packExe pack /l /o /d ..\Build\Appx /p ..\Build\QuickLook-$version.appx

0 commit comments

Comments
 (0)