diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 658d5e045ba..8cc8883e8ff 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -243,9 +243,6 @@ void EditorManagerPlaceHolder::showEvent(QShowEvent *) opened editor. \value DoNotMakeVisible Does not force the editor to become visible. - \value CanContainLineAndColumnNumber - If the file path contains line and column numbers, opens - the file in an editor and jumps to the line and column. \value OpenInOtherSplit Opens the document in another split of the window. \value DoNotSwitchToDesignMode @@ -3072,8 +3069,6 @@ IEditor *EditorManager::openEditor(const QString &fileName, Id editorId, OpenEditorFlags flags, bool *newEditor) { QFileInfo fi(fileName); - if ((flags & CanContainLineAndColumnNumber) && !fi.exists()) - return openEditorAt(Link::fromString(fileName, true), editorId, flags, newEditor); return openEditor(FilePath::fromString(fileName), editorId, flags, newEditor); } diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h index aadb89483b6..84f7842b65b 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.h +++ b/src/plugins/coreplugin/editormanager/editormanager.h @@ -80,12 +80,11 @@ public: DoNotChangeCurrentEditor = 1, IgnoreNavigationHistory = 2, DoNotMakeVisible = 4, - CanContainLineAndColumnNumber = 8, - OpenInOtherSplit = 16, - DoNotSwitchToDesignMode = 32, - DoNotSwitchToEditMode = 64, - SwitchSplitIfAlreadyVisible = 128, - DoNotRaise = 256 + OpenInOtherSplit = 8, + DoNotSwitchToDesignMode = 16, + DoNotSwitchToEditMode = 32, + SwitchSplitIfAlreadyVisible = 64, + DoNotRaise = 128 }; Q_DECLARE_FLAGS(OpenEditorFlags, OpenEditorFlag) diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index ec73da4afaa..aaeef7e3b89 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -900,26 +900,30 @@ IDocument *MainWindow::openFiles(const QStringList &fileNames, if (flags & ICore::SwitchMode) ModeManager::activateMode(Id(Constants::MODE_EDIT)); } - } else { + } else if (flags & (ICore::SwitchSplitIfAlreadyVisible | ICore::CanContainLineAndColumnNumbers) + || !res) { QFlags emFlags; - if (flags & ICore::CanContainLineAndColumnNumbers) - emFlags |= EditorManager::CanContainLineAndColumnNumber; if (flags & ICore::SwitchSplitIfAlreadyVisible) emFlags |= EditorManager::SwitchSplitIfAlreadyVisible; - if (emFlags != EditorManager::NoFlags || !res) { - IEditor *editor = EditorManager::openEditor(absoluteFilePath, Id(), emFlags); - if (!editor) { - if (flags & ICore::StopOnLoadFail) - return res; - } else if (!res) { - res = editor->document(); - } + IEditor *editor = nullptr; + if (flags & ICore::CanContainLineAndColumnNumbers) { + const Link &link = Link::fromString(absoluteFilePath, true); + editor = EditorManager::openEditorAt(link, {}, emFlags); } else { - auto *factory = IEditorFactory::preferredEditorFactories(absoluteFilePath).value(0); - DocumentModelPrivate::addSuspendedDocument(absoluteFilePath, - {}, - factory ? factory->id() : Id()); + const FilePath &filePath = FilePath::fromString(absoluteFilePath); + editor = EditorManager::openEditor(filePath, {}, emFlags); } + if (!editor) { + if (flags & ICore::StopOnLoadFail) + return res; + } else if (!res) { + res = editor->document(); + } + } else { + auto *factory = IEditorFactory::preferredEditorFactories(absoluteFilePath).value(0); + DocumentModelPrivate::addSuspendedDocument(absoluteFilePath, + {}, + factory ? factory->id() : Id()); } } return res;