summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2022-03-21 14:08:13 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2022-03-25 13:31:36 +0000
commita3e0b139de16e08dd72464f50d14ffc5ce4f0b34 (patch)
treeaa798c306d38f164f7ba50850bd5033ad4ed0c6c
parentff8d672fa252362223c02f644a59bfa67c6c76ab (diff)
downloadqt-creator-a3e0b139de16e08dd72464f50d14ffc5ce4f0b34.tar.gz
TextEditor: Make sure cursor is visible after refactoring
Fixes: QTCREATORBUG-27210 Change-Id: I612f6e91188730d6abdfef3f2fe8a286fcec4831 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
-rw-r--r--src/plugins/texteditor/refactoringchanges.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/texteditor/refactoringchanges.cpp b/src/plugins/texteditor/refactoringchanges.cpp
index 6872c18c60..506290732f 100644
--- a/src/plugins/texteditor/refactoringchanges.cpp
+++ b/src/plugins/texteditor/refactoringchanges.cpp
@@ -332,10 +332,13 @@ bool RefactoringFile::apply()
}
// open / activate / goto position
+ bool ensureCursorVisible = false;
if (m_openEditor && !m_filePath.isEmpty()) {
int line = -1, column = -1;
- if (m_editorCursorPosition != -1)
+ if (m_editorCursorPosition != -1) {
lineAndColumn(m_editorCursorPosition, &line, &column);
+ ensureCursorVisible = true;
+ }
m_editor = RefactoringChanges::openEditor(m_filePath, m_activateEditor, line, column);
m_openEditor = false;
m_activateEditor = false;
@@ -396,6 +399,9 @@ bool RefactoringFile::apply()
}
}
+ if (m_editor && ensureCursorVisible)
+ m_editor->ensureCursorVisible();
+
m_appliedOnce = true;
return result;
}