[BUG_FIXED] Fix the bug of last session's doc position are not rescrolled on Notepad++ launch time if wrap mode is activated.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@139 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2008-03-01 19:02:56 +00:00
parent 2b1e41512f
commit c7162f9555
4 changed files with 4 additions and 30 deletions

View File

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

View File

@ -93,7 +93,6 @@ struct HeaderLineState {
struct Position
{
int _firstVisibleLine;
int _wrapOffset;
int _startPos;
int _endPos;
int _xOffset;

View File

@ -872,13 +872,13 @@ void ScintillaEditView::saveCurrentPos()
//Save data so, that the current topline becomes visible again after restoring.
int displayedLine = static_cast<int>(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<int>(execute(SCI_GETSELECTIONSTART));
buf._pos._endPos = static_cast<int>(execute(SCI_GETSELECTIONEND));
buf._pos._xOffset = static_cast<int>(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);
}

View File

@ -243,10 +243,6 @@ public:
void saveCurrentPos();
void restoreCurrentPos();
bool needRestoreFromWrap() {
return _wrapRestoreNeeded;
}
void restoreFromWrap();
Buffer & getBufferAt(size_t index) {