diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 1db23370..0903d662 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -1953,13 +1953,6 @@ BOOL Notepad_plus::notify(SCNotification *notification) case SCN_PAINTED: { - //Wrapping messes up visible lines, restore after SCN_PAINTED as doc. says - - if (_pEditView->needRestoreFromWrap()) - { - _pEditView->restoreFromWrap(); - } - if (_syncInfo.doSync()) doSynScorll(HWND(notification->nmhdr.hwndFrom)); diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index b3f6810d..87010bca 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -93,7 +93,6 @@ struct HeaderLineState { struct Position { int _firstVisibleLine; - int _wrapOffset; int _startPos; int _endPos; int _xOffset; diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 9430831d..29a06852 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -872,13 +872,13 @@ void ScintillaEditView::saveCurrentPos() //Save data so, that the current topline becomes visible again after restoring. int displayedLine = static_cast(execute(SCI_GETFIRSTVISIBLELINE)); int docLine = execute(SCI_DOCLINEFROMVISIBLE, displayedLine); //linenumber of the line displayed in the top - int offset = displayedLine - 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 = _buffers[_currentIndex]; // the correct visible line number buf._pos._firstVisibleLine = docLine;//docLine - nbInvisibleLine; - buf._pos._wrapOffset = offset; + buf._pos._startPos = static_cast(execute(SCI_GETSELECTIONSTART)); buf._pos._endPos = static_cast(execute(SCI_GETSELECTIONEND)); buf._pos._xOffset = static_cast(execute(SCI_GETXOFFSET)); @@ -892,12 +892,6 @@ void ScintillaEditView::restoreCurrentPos() Buffer & buf = _buffers[_currentIndex]; - if (!_wrapRestoreNeeded) - { - int lineToShow = execute(SCI_VISIBLEFROMDOCLINE, buf._pos._firstVisibleLine); - scroll(0, lineToShow); - } - if (buf._pos._selMode == SC_SEL_RECTANGLE) { execute(SCI_SETSELECTIONMODE, buf._pos._selMode); @@ -905,18 +899,10 @@ void ScintillaEditView::restoreCurrentPos() execute(SCI_SETSELECTIONSTART, buf._pos._startPos); execute(SCI_SETSELECTIONEND, buf._pos._endPos); execute(SCI_SETXOFFSET, buf._pos._xOffset); -} - -void ScintillaEditView::restoreFromWrap() -{ - Buffer & buf = _buffers[_currentIndex]; + // these 2 lines should be at the end so it works in wrap mode int lineToShow = execute(SCI_VISIBLEFROMDOCLINE, buf._pos._firstVisibleLine); - - //Scroll to the line that corresponds to the stored docline and then some more for the wrapping offset. - //Should work with folding too. - scroll(0, lineToShow + buf._pos._wrapOffset); - _wrapRestoreNeeded = false; + scroll(0, lineToShow); } diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index 61101712..e8f868f8 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -243,10 +243,6 @@ public: void saveCurrentPos(); void restoreCurrentPos(); - bool needRestoreFromWrap() { - return _wrapRestoreNeeded; - } - void restoreFromWrap(); Buffer & getBufferAt(size_t index) {