From fdf954f714325b41a86b745f3e3525277ba17ca4 Mon Sep 17 00:00:00 2001 From: Don HO Date: Wed, 31 Oct 2018 00:38:26 +0100 Subject: [PATCH] Revert "Fix scintilla restoring wrapped buffer issue" due to a serious performance issue Check https://notepad-plus-plus.org/community/topic/16468/notepad-7-5-9-release This reverts commit 40192bda0ccbd18077abb02fac30292dfe8e62f4. --- PowerEditor/src/Parameters.cpp | 2 +- PowerEditor/src/Parameters.h | 1 - PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp | 6 +----- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index d5e79753b..d580a251f 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -2040,7 +2040,7 @@ bool NppParameters::getSessionFromXmlTree(TiXmlDocument *pSessionDoc, Session *p (childNode->ToElement())->Attribute(TEXT("endPos"), &position._endPos); (childNode->ToElement())->Attribute(TEXT("selMode"), &position._selMode); (childNode->ToElement())->Attribute(TEXT("scrollWidth"), &position._scrollWidth); - (childNode->ToElement())->Attribute(TEXT("offset"), &position._offset); + MapPosition mapPosition; int32_t mapPosVal; const TCHAR *mapPosStr = (childNode->ToElement())->Attribute(TEXT("mapFirstVisibleDisplayLine"), &mapPosVal); diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 43af6f6d6..d1fbec616 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -134,7 +134,6 @@ struct Position int _xOffset = 0; int _selMode = 0; int _scrollWidth = 1; - int _offset = 0; }; diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 575d002a6..46586a1d9 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -1755,7 +1755,7 @@ void ScintillaEditView::saveCurrentPos() //Save data so, that the current topline becomes visible again after restoring. int32_t displayedLine = static_cast(execute(SCI_GETFIRSTVISIBLELINE)); int32_t docLine = static_cast(execute(SCI_DOCLINEFROMVISIBLE, displayedLine)); //linenumber of the line displayed in the top - int32_t offset = displayedLine - static_cast(execute(SCI_VISIBLEFROMDOCLINE, docLine)); //use this to calc offset of wrap. If no wrap this should be zero + //int offset = displayedLine - execute(SCI_VISIBLEFROMDOCLINE, docLine); //use this to calc offset of wrap. If no wrap this should be zero Buffer * buf = MainFileManager->getBufferByID(_currentBufferID); @@ -1767,7 +1767,6 @@ void ScintillaEditView::saveCurrentPos() pos._xOffset = static_cast(execute(SCI_GETXOFFSET)); pos._selMode = static_cast(execute(SCI_GETSELECTIONMODE)); pos._scrollWidth = static_cast(execute(SCI_GETSCROLLWIDTH)); - pos._offset = offset; buf->setPosition(pos, this); } @@ -1789,11 +1788,8 @@ void ScintillaEditView::restoreCurrentPos() execute(SCI_SETXOFFSET, pos._xOffset); } execute(SCI_CHOOSECARETX); // choose current x position - execute(SCI_ENSUREVISIBLE); //Make sure the caret is visible (this will also fix wrapping problems) int lineToShow = static_cast(execute(SCI_VISIBLEFROMDOCLINE, pos._firstVisibleLine)); - lineToShow += pos._offset; - scroll(0, lineToShow); }