aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/vcsbase/vcsbaseeditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/vcsbase/vcsbaseeditor.cpp')
-rw-r--r--src/plugins/vcsbase/vcsbaseeditor.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp
index 0f334b7f13..37fc44bacd 100644
--- a/src/plugins/vcsbase/vcsbaseeditor.cpp
+++ b/src/plugins/vcsbase/vcsbaseeditor.cpp
@@ -424,11 +424,10 @@ bool UrlTextCursorHandler::findContentsUnderCursor(const QTextCursor &cursor)
if (cursorForUrl.hasSelection()) {
const QString line = cursorForUrl.selectedText();
const int cursorCol = cursor.columnNumber();
- int urlMatchIndex = -1;
QRegularExpressionMatchIterator i = m_pattern.globalMatch(line);
while (i.hasNext()) {
const QRegularExpressionMatch match = i.next();
- urlMatchIndex = match.capturedStart();
+ const int urlMatchIndex = match.capturedStart();
const QString url = match.captured(0);
if (urlMatchIndex <= cursorCol && cursorCol <= urlMatchIndex + url.length()) {
m_urlData.startColumn = urlMatchIndex;
@@ -443,14 +442,15 @@ bool UrlTextCursorHandler::findContentsUnderCursor(const QTextCursor &cursor)
void UrlTextCursorHandler::highlightCurrentContents()
{
+ const QColor linkColor = creatorTheme()->color(Theme::TextColorLink);
QTextEdit::ExtraSelection sel;
sel.cursor = currentCursor();
sel.cursor.setPosition(currentCursor().position()
- (currentCursor().columnNumber() - m_urlData.startColumn));
sel.cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, m_urlData.url.length());
sel.format.setFontUnderline(true);
- sel.format.setForeground(Qt::blue);
- sel.format.setUnderlineColor(Qt::blue);
+ sel.format.setForeground(linkColor);
+ sel.format.setUnderlineColor(linkColor);
sel.format.setProperty(QTextFormat::UserProperty, m_urlData.url);
editorWidget()->setExtraSelections(VcsBaseEditorWidget::OtherSelection,
QList<QTextEdit::ExtraSelection>() << sel);
@@ -828,6 +828,12 @@ void VcsBaseEditorWidget::setFileLogAnnotateEnabled(bool e)
d->m_fileLogAnnotateEnabled = e;
}
+void VcsBaseEditorWidget::setHighlightingEnabled(bool e)
+{
+ auto dh = static_cast<DiffAndLogHighlighter *>(textDocument()->syntaxHighlighter());
+ dh->setEnabled(e);
+}
+
QString VcsBaseEditorWidget::workingDirectory() const
{
return d->m_workingDirectory;