summaryrefslogtreecommitdiff
path: root/src/plugins/coreplugin/editormanager
diff options
context:
space:
mode:
authorRazi Alavizadeh <s.r.alavizadeh@gmail.com>2018-06-14 13:37:09 +0430
committerRazi Alavizadeh <s.r.alavizadeh@gmail.com>2018-06-22 18:04:54 +0000
commitf009d5f151c5ed2e306ffd1b179d500684073a87 (patch)
tree7088a75240ea1840a98ec4ac0832c37a40c47e81 /src/plugins/coreplugin/editormanager
parentffc651d54ee619c8779a79c6f430efbf106ee61b (diff)
downloadqt-creator-f009d5f151c5ed2e306ffd1b179d500684073a87.tar.gz
CorePlugin: Switch split if remote command tries to open an already opened file
It seems more natural that remote commands don't change current editor of active view if file is already opened in another view. Change-Id: Ie27de0d159cae6e63fa1d477fab59887a0e6d198 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/coreplugin/editormanager')
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager.cpp11
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager.h3
2 files changed, 13 insertions, 1 deletions
diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index 4671f17422..5c46d683bc 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -576,6 +576,17 @@ IEditor *EditorManagerPrivate::openEditor(EditorView *view, const QString &fileN
const QList<IEditor *> editors = DocumentModel::editorsForFilePath(fn);
if (!editors.isEmpty()) {
IEditor *editor = editors.first();
+ if (flags & EditorManager::SwitchSplitIfAlreadyVisible) {
+ for (IEditor *ed : editors) {
+ EditorView *v = viewForEditor(ed);
+ // Don't switch to a view where editor is not its current editor
+ if (v && v->currentEditor() == ed) {
+ editor = ed;
+ view = v;
+ break;
+ }
+ }
+ }
editor = activateEditor(view, editor, flags);
if (editor && flags & EditorManager::CanContainLineAndColumnNumber)
editor->gotoLine(lineNumber, columnNumber);
diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h
index 17d84431e3..ab5a217e96 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.h
+++ b/src/plugins/coreplugin/editormanager/editormanager.h
@@ -89,7 +89,8 @@ public:
CanContainLineAndColumnNumber = 8,
OpenInOtherSplit = 16,
DoNotSwitchToDesignMode = 32,
- DoNotSwitchToEditMode = 64
+ DoNotSwitchToEditMode = 64,
+ SwitchSplitIfAlreadyVisible = 128
};
Q_DECLARE_FLAGS(OpenEditorFlags, OpenEditorFlag)