Skip to content

Commit

Permalink
Fix textviewer highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
xupefei committed Nov 23, 2022
1 parent b80c264 commit 7b5b01a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions QuickLook.Plugin/QuickLook.Plugin.TextViewer/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private HighlightingManager getHighlightingManager(Themes theme, string dirName)
if (!Directory.Exists(syntaxPath))
return hlm;

foreach (var file in Directory.EnumerateFiles(syntaxPath, "*.xshd"))
foreach (var file in Directory.EnumerateFiles(syntaxPath, "*.xshd").OrderBy(f => f))
{
Debug.WriteLine(file);
var ext = Path.GetFileNameWithoutExtension(file);
Expand All @@ -146,7 +146,8 @@ private HighlightingManager getHighlightingManager(Themes theme, string dirName)
}
private void AssignHighlightingManager(TextViewerPanel tvp, ContextObject context)
{
var isDark = (context.Theme == Themes.Dark) | OSThemeHelper.AppsUseDarkTheme() | false;
var darkThemeAllowed = SettingHelper.Get("AllowDarkTheme", false, "QuickLook.Plugin.TextViewer");
var isDark = darkThemeAllowed && OSThemeHelper.AppsUseDarkTheme();
tvp.HighlightingManager = isDark ? _hlmDark : _hlmLight;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="Syntax\**">
<CopyToOutputDirectory>None</CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="app.config" />
<None Include="packages.config" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ public TextViewerPanel(string path, ContextObject context)
{
_context = context;

SetResourceReference(Control.ForegroundProperty, "WindowTextForeground");
Background = Brushes.Transparent;
Background = OSThemeHelper.AppsUseDarkTheme()
? new SolidColorBrush(Color.FromArgb(150, 255, 255, 255))
: Brushes.Transparent;
FontSize = 14;
ShowLineNumbers = true;
WordWrap = true;
Expand Down
4 changes: 2 additions & 2 deletions Scripts/pack-appx.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ if(-not (Test-Path env:CI))
Update-Version("..\Build\Appx\AppxManifest.xml")

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

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

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

0 comments on commit 7b5b01a

Please sign in to comment.