From 062ec3e7267fd99e802b63e861b9cf38f0cd64ec Mon Sep 17 00:00:00 2001 From: Don HO Date: Mon, 6 Jan 2020 13:40:49 +0100 Subject: [PATCH] Simplefy the commit 9387dcdaef19289af87f24639bf7336526d027f5 --- PowerEditor/src/NppNotification.cpp | 10 ++-------- .../src/ScitillaComponent/ScintillaEditView.cpp | 3 +++ PowerEditor/src/ScitillaComponent/ScintillaEditView.h | 2 -- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp index 6836b290c..e99d7a18a 100644 --- a/PowerEditor/src/NppNotification.cpp +++ b/PowerEditor/src/NppNotification.cpp @@ -948,14 +948,8 @@ BOOL Notepad_plus::notify(SCNotification *notification) // Check if a restore position is needed. // Restoring a position must done after SCN_PAINTED notification so that it works in every circumstances (including wrapped large file) - if (_mainEditView.isPositionRestoreNeeded()) - { - _mainEditView.restoreCurrentPosPostStep(); - } - if (_subEditView.isPositionRestoreNeeded()) - { - _subEditView.restoreCurrentPosPostStep(); - } + _mainEditView.restoreCurrentPosPostStep(); + _subEditView.restoreCurrentPosPostStep(); // ViewMoveAtWrappingDisableFix: Disable wrapping messes up visible lines. // Therefore save view position before in IDM_VIEW_WRAP and restore after SCN_PAINTED, as doc. says diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index a08a012ba..a4d970cd9 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -1846,6 +1846,9 @@ void ScintillaEditView::restoreCurrentPosPreStep() // to scroll several lines to set the first visible line to the correct wrapped line. void ScintillaEditView::restoreCurrentPosPostStep() { + if (!_positionRestoreNeeded) + return; + static int32_t restoreDone = 0; Buffer * buf = MainFileManager.getBufferByID(_currentBufferID); Position & pos = buf->getPosition(this); diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index 2f4b4b539..1ea1b99e7 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -633,8 +633,6 @@ public: void setTabSettings(Lang *lang); bool isWrapRestoreNeeded() const {return _wrapRestoreNeeded;}; void setWrapRestoreNeeded(bool isWrapRestoredNeeded) {_wrapRestoreNeeded = isWrapRestoredNeeded;}; - bool isPositionRestoreNeeded() const {return _positionRestoreNeeded;}; - bool isCJK() const { return ((_codepage == CP_CHINESE_TRADITIONAL) || (_codepage == CP_CHINESE_SIMPLIFIED) ||