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 40192bda0c.
This commit is contained in:
Don HO 2018-10-31 00:38:26 +01:00
parent ab8b5dc7a0
commit fdf954f714
3 changed files with 2 additions and 7 deletions

View File

@ -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);

View File

@ -134,7 +134,6 @@ struct Position
int _xOffset = 0;
int _selMode = 0;
int _scrollWidth = 1;
int _offset = 0;
};

View File

@ -1755,7 +1755,7 @@ void ScintillaEditView::saveCurrentPos()
//Save data so, that the current topline becomes visible again after restoring.
int32_t displayedLine = static_cast<int32_t>(execute(SCI_GETFIRSTVISIBLELINE));
int32_t docLine = static_cast<int32_t>(execute(SCI_DOCLINEFROMVISIBLE, displayedLine)); //linenumber of the line displayed in the top
int32_t offset = displayedLine - static_cast<int32_t>(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<int>(execute(SCI_GETXOFFSET));
pos._selMode = static_cast<int32_t>(execute(SCI_GETSELECTIONMODE));
pos._scrollWidth = static_cast<int32_t>(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<int32_t>(execute(SCI_VISIBLEFROMDOCLINE, pos._firstVisibleLine));
lineToShow += pos._offset;
scroll(0, lineToShow);
}