diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2022-03-21 14:08:13 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2022-03-25 13:31:36 +0000 |
commit | a3e0b139de16e08dd72464f50d14ffc5ce4f0b34 (patch) | |
tree | aa798c306d38f164f7ba50850bd5033ad4ed0c6c | |
parent | ff8d672fa252362223c02f644a59bfa67c6c76ab (diff) | |
download | qt-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.cpp | 8 |
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; } |