meven added a comment.
I believe the issue currently is that for text files or files without associated definition we end up with an invalid definition that prevents SyntaxHighlighter::setDefinition to call rehighlight(). QTextDocument uses then whatever it get from the theme I guess. Kate has an explicit special case in KateHighlighting::KateHighlighting to insert a default Format. I think either KSyntaxHighlighting should have a dummy default definition based on currrent theme or we should here create a dummy default definition when `m_highlightingRepository.definitionForFileName(path)` return an invalid definition. What do you think ? REVISION DETAIL https://phabricator.kde.org/D20766 To: eshalygin, kossebau, cfeck Cc: dhaumann, cullmann, vkrause, cfeck, meven, broulik, kde-frameworks-devel, kfm-devel, pberestov, iasensio, fprice, LeGast00n, MrPepe, fbampaloukas, alexde, GB_2, Codezela, feverfew, michaelh, spoorun, navarromorales, firef, ngraham, andrebarros, bruns, emmanuelp, mikesomov