From a3e0b139de16e08dd72464f50d14ffc5ce4f0b34 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 21 Mar 2022 14:08:13 +0100 Subject: TextEditor: Make sure cursor is visible after refactoring Fixes: QTCREATORBUG-27210 Change-Id: I612f6e91188730d6abdfef3f2fe8a286fcec4831 Reviewed-by: David Schulz Reviewed-by: --- src/plugins/texteditor/refactoringchanges.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; } -- cgit v1.2.3