From cd638b98bdec703d18a29322478cc267aa541157 Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Thu, 2 Apr 2009 17:56:20 +0200 Subject: [PATCH] Keep cursor position and scroll state when reloading text editors. Regression coming from the new navigation history mechanism. --- src/plugins/texteditor/basetexteditor.cpp | 4 ++-- src/plugins/texteditor/basetexteditor_p.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index ca9a7faf363..5ef655e7997 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -2328,13 +2328,13 @@ void BaseTextEditor::slotUpdateRequest(const QRect &r, int dy) void BaseTextEditor::saveCurrentCursorPositionForNavigation() { d->m_lastCursorChangeWasInteresting = true; - d->m_tempState = saveState(); + d->m_tempNavigationState = saveState(); } void BaseTextEditor::slotCursorPositionChanged() { if (!d->m_contentsChanged && d->m_lastCursorChangeWasInteresting) { - Core::EditorManager::instance()->addCurrentPositionToNavigationHistory(d->m_tempState); + Core::EditorManager::instance()->addCurrentPositionToNavigationHistory(d->m_tempNavigationState); d->m_lastCursorChangeWasInteresting = false; } else if (d->m_contentsChanged) { saveCurrentCursorPositionForNavigation(); diff --git a/src/plugins/texteditor/basetexteditor_p.h b/src/plugins/texteditor/basetexteditor_p.h index bed889d5a14..e7a39515f8d 100644 --- a/src/plugins/texteditor/basetexteditor_p.h +++ b/src/plugins/texteditor/basetexteditor_p.h @@ -147,6 +147,7 @@ public: QRefCountPointer<BaseTextDocument> m_document; QByteArray m_tempState; + QByteArray m_tempNavigationState; QString m_displayName; bool m_parenthesesMatchingEnabled; -- GitLab