TextEditor: After refactoring, do not open the same document again

... if it is already visible in a different split view. Activate that
one instead.

Fixes: QTCREATORBUG-13145
Change-Id: I5facfb23e8e8163d8653c7926d5bf6848f42bd9a
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2020-08-12 12:39:27 +02:00
parent 2d61932387
commit 0222d5007e

View File

@@ -124,7 +124,9 @@ bool RefactoringChanges::removeFile(const QString &fileName) const
TextEditorWidget *RefactoringChanges::openEditor(const QString &fileName, bool activate, int line, int column) TextEditorWidget *RefactoringChanges::openEditor(const QString &fileName, bool activate, int line, int column)
{ {
EditorManager::OpenEditorFlags flags = EditorManager::IgnoreNavigationHistory; EditorManager::OpenEditorFlags flags = EditorManager::IgnoreNavigationHistory;
if (!activate) if (activate)
flags |= EditorManager::SwitchSplitIfAlreadyVisible;
else
flags |= EditorManager::DoNotChangeCurrentEditor; flags |= EditorManager::DoNotChangeCurrentEditor;
if (line != -1) { if (line != -1) {
// openEditorAt uses a 1-based line and a 0-based column! // openEditorAt uses a 1-based line and a 0-based column!