forked from qt-creator/qt-creator
Don't repeat the same code
Change-Id: Ied1d816481bef760a49a4572e9fda1f6ac538daa Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -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<TextEditorWidget>(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<TextEditorWidget>(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<TextEditorWidget>(q)](const Link &symbolLink) {
|
||||
if (self)
|
||||
self->openLink(symbolLink, openInNextSplit);
|
||||
}, true, openInNextSplit);
|
||||
}
|
||||
|
||||
|
||||
bool TextEditorWidget::codeFoldingVisible() const
|
||||
{
|
||||
return d->m_codeFoldingVisible;
|
||||
|
Reference in New Issue
Block a user