forked from qt-creator/qt-creator
SyntaxHighlighter: Move highlighter creating to TextDocument
Added setSyntaxHighlighterCreator function to TextDocument which allows the creation of highlighters inside TextDocument. Change-Id: I454f800c878c48a154dad5abd68b7a4f9ceb378a Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -246,9 +246,11 @@ void GitEditorWidget::init()
|
||||
return;
|
||||
const QChar commentChar = gitClient().commentChar(source());
|
||||
if (isCommitEditor)
|
||||
textDocument()->setSyntaxHighlighter(new GitSubmitHighlighter(commentChar));
|
||||
textDocument()->setSyntaxHighlighterCreator(
|
||||
[commentChar] { return new GitSubmitHighlighter(commentChar); });
|
||||
else if (isRebaseEditor)
|
||||
textDocument()->setSyntaxHighlighter(new GitRebaseHighlighter(commentChar));
|
||||
textDocument()->setSyntaxHighlighterCreator(
|
||||
[commentChar] { return new GitRebaseHighlighter(commentChar); });
|
||||
}
|
||||
|
||||
void GitEditorWidget::addDiffActions(QMenu *menu, const DiffChunk &chunk)
|
||||
|
||||
Reference in New Issue
Block a user