From 971285fc9597ab632a663c49899511b8a2269654 Mon Sep 17 00:00:00 2001 From: Paddy Xu Date: Tue, 6 Jul 2021 21:10:41 +0200 Subject: [PATCH] Fix #948: disable syntax highlighing when file is too big --- .../QuickLook.Plugin.TextViewer/TextViewerPanel.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.cs b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.cs index a7201a5..e93a246 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.cs @@ -118,7 +118,7 @@ namespace QuickLook.Plugin.TextViewer private class TruncateLongLines : VisualLineElementGenerator { const int MAX_LENGTH = 10000; - const string ELLIPSIS = "……………"; + const string ELLIPSIS = "⁞⁞[TRUNCATED]⁞⁞"; public override int GetFirstInterestedOffset(int startOffset) { @@ -181,7 +181,9 @@ namespace QuickLook.Plugin.TextViewer Dispatcher.BeginInvoke(new Action(() => { Encoding = encoding; - SyntaxHighlighting = HighlightingManager.Instance.GetDefinitionByExtension(Path.GetExtension(path)); + SyntaxHighlighting = tooLong + ? null + : HighlightingManager.Instance.GetDefinitionByExtension(Path.GetExtension(path)); Document = doc; _context.IsBusy = false;