diff --git a/src/MadEdit/MadEdit.cpp b/src/MadEdit/MadEdit.cpp index 9ab4f146..42ef7469 100644 --- a/src/MadEdit/MadEdit.cpp +++ b/src/MadEdit/MadEdit.cpp @@ -3706,7 +3706,7 @@ void MadEdit::UpdateScrollBarPos() { m_VScrollBar->Enable(); int ymax = int( m_Lines->m_RowCount ) + m_PageRowCount - 1; - if (IsPartialLoadMode()) + if ( IsPartialLoadMode() ) { MadLineIterator lineiter; int subrowid = m_TopRow; @@ -3778,7 +3778,7 @@ void MadEdit::UpdateScrollBarPos() { m_VScrollBar->Enable( true ); - if (IsPartialLoadMode()) + if ( IsPartialLoadMode() ) { MadLineIterator lineiter; int subrowid = m_TopRow; @@ -10794,10 +10794,23 @@ void MadEdit::OnSize( wxSizeEvent &evt ) void MadEdit::OnVScroll( wxScrollEvent &evt ) { m_TopRow = evt.GetPosition(); - DBOUT( "OnVScroll:"< m_LineidEnd) + { + LoadPartial(lineid); + } + m_TopRow = GetLineByLine(lit, pos, lineid - m_LineidBeg); + } + if( m_TopRow < 0 ) m_TopRow = 0; else if( m_TopRow >= int( m_Lines->m_RowCount ) ) m_TopRow = int( m_Lines->m_RowCount - 1 ); diff --git a/src/MadEdit/MadEditAdvanced.cpp b/src/MadEdit/MadEditAdvanced.cpp index ffeb2fa8..db556308 100644 --- a/src/MadEdit/MadEditAdvanced.cpp +++ b/src/MadEdit/MadEditAdvanced.cpp @@ -4329,6 +4329,12 @@ bool MadEdit::LoadPartial(wxFileOffset pos) !m_Lines->LoadPartial(m_PosOffsetBeg, m_PosOffsetEnd - m_PosOffsetBeg + 1)) return false; m_PosCaretPos = oldCaretPos; + m_ValidPos_iter = m_Lines->m_LineList.begin(); + m_ValidPos_lineid = 0; + m_ValidPos_rowid = 0; + m_ValidPos_pos = 0; + m_CaretPos.Reset( m_ValidPos_iter ); + m_LastCaretXPos = 0; return true; }