Commit 4ec12a85 authored by Ilia Kats's avatar Ilia Kats
Browse files

fix preview of plain text files when using dark theme

BUG: 409380 406821
Differential Revision: https://phabricator.kde.org/D25891
parent d9239aa5
......@@ -162,10 +162,12 @@ bool TextCreator::create(const QString &path, int width, int height, QImage &img
textOption.setWrapMode( QTextOption::WrapAtWordBoundaryOrAnywhere );
textDocument.setDefaultTextOption(textOption);
KSyntaxHighlighting::SyntaxHighlighter syntaxHighlighter(&textDocument);
KSyntaxHighlighting::SyntaxHighlighter syntaxHighlighter;
syntaxHighlighter.setDefinition(m_highlightingRepository.definitionForFileName(path));
const auto highlightingTheme = m_highlightingRepository.defaultTheme(KSyntaxHighlighting::Repository::LightTheme);
syntaxHighlighter.setTheme(highlightingTheme);
syntaxHighlighter.setDocument(&textDocument);
syntaxHighlighter.rehighlight();
// draw page-in-page, with clipping as needed
painter.translate(xborder, yborder);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment