diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index d6d83296afd..05a1994c317 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -618,6 +618,7 @@ public: void updateSyntaxInfoBar(const Highlighter::Definitions &definitions, const QString &fileName); void configureGenericHighlighter(const KSyntaxHighlighting::Definition &definition); void rememberCurrentSyntaxDefinition(); + void openLinkUnderCursor(bool openInNextSplit); public: TextEditorWidget *q; @@ -1958,22 +1959,12 @@ void TextEditorWidget::redo() void TextEditorWidget::openLinkUnderCursor() { - const bool openInNextSplit = alwaysOpenLinksInNextSplit(); - findLinkAt(textCursor(), - [openInNextSplit, self = QPointer(this)](const Link &symbolLink) { - if (self) - self->openLink(symbolLink, openInNextSplit); - }, true, openInNextSplit); + d->openLinkUnderCursor(alwaysOpenLinksInNextSplit()); } void TextEditorWidget::openLinkUnderCursorInNextSplit() { - const bool openInNextSplit = !alwaysOpenLinksInNextSplit(); - findLinkAt(textCursor(), - [openInNextSplit, self = QPointer(this)](const Link &symbolLink) { - if (self) - self->openLink(symbolLink, openInNextSplit); - }, true, openInNextSplit); + d->openLinkUnderCursor(!alwaysOpenLinksInNextSplit()); } void TextEditorWidget::findUsages() @@ -3247,6 +3238,16 @@ void TextEditorWidgetPrivate::rememberCurrentSyntaxDefinition() Highlighter::rememberDefinitionForDocument(definition, m_document.data()); } +void TextEditorWidgetPrivate::openLinkUnderCursor(bool openInNextSplit) +{ + q->findLinkAt(q->textCursor(), + [openInNextSplit, self = QPointer(q)](const Link &symbolLink) { + if (self) + self->openLink(symbolLink, openInNextSplit); + }, true, openInNextSplit); +} + + bool TextEditorWidget::codeFoldingVisible() const { return d->m_codeFoldingVisible;