diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index 76912be772794e73d1eb799599741147b45ae380..a3bce5276fee7f00a8c0461d91310c83187fbfe7 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -1215,8 +1215,12 @@ IEditor *EditorManager::openEditor(Core::Internal::EditorView *view, const QStri
         *newEditor = false;
 
     const QList<IEditor *> editors = editorsForFileName(fn);
-    if (!editors.isEmpty())
-        return activateEditor(view, editors.first(), flags);
+    if (!editors.isEmpty()) {
+        IEditor *editor = editors.first();
+        if (flags && EditorManager::CanContainLineNumber)
+            editor->gotoLine(lineNumber, -1);
+        return activateEditor(view, editor, flags);
+    }
 
     QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
     IEditor *editor = createEditor(editorId, fn);