Skip to content

Commit

Permalink
Merge pull request #1320 from beru/PageUp_PageDown
Browse files Browse the repository at this point in the history
PageUp, PageDown 時に描画する必要が無い場合は描画しないようにする判定を追加
  • Loading branch information
beru authored Sep 6, 2020
2 parents e34c4aa + 60e290f commit 2d2f3cb
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions sakura_core/cmd/CViewCommander_Cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,11 +740,17 @@ void CViewCommander::Command_1PageUp( bool bSelect, CLayoutYInt nScrollNum )
if( nScrollNum <= 0 ){
nScrollNum = m_pCommanderView->GetTextArea().m_nViewRowNum - 1;
}
GetCaret().Cursor_UPDOWN( -nScrollNum, bSelect );
// Sep. 11, 2004 genta 同期スクロール処理のため
// m_pCommanderView->RedrawAllではなくScrollAtを使うように
m_pCommanderView->SyncScrollV( m_pCommanderView->ScrollAtV( nViewTopLine - nScrollNum ));
auto& caret = GetCaret();
auto prevCaretPos = caret.GetCaretLayoutPos();
caret.Cursor_UPDOWN( -nScrollNum, bSelect );
auto currCaretPos = caret.GetCaretLayoutPos();
CLayoutInt nScrolled = m_pCommanderView->ScrollAtV( nViewTopLine - nScrollNum );
m_pCommanderView->SyncScrollV(nScrolled);
m_pCommanderView->SetDrawSwitch(bDrawSwitchOld);
// カーソル位置が変化しなかった、かつ、スクロール行数が0だった場合、描画を省く
if (prevCaretPos == currCaretPos && nScrolled == 0) {
return;
}
m_pCommanderView->RedrawAll();
}
return;
Expand All @@ -769,11 +775,17 @@ void CViewCommander::Command_1PageDown( bool bSelect, CLayoutYInt nScrollNum )
if( nScrollNum <= 0 ){
nScrollNum = m_pCommanderView->GetTextArea().m_nViewRowNum - 1;
}
GetCaret().Cursor_UPDOWN( nScrollNum, bSelect );
// Sep. 11, 2004 genta 同期スクロール処理のため
// m_pCommanderView->RedrawAllではなくScrollAtを使うように
m_pCommanderView->SyncScrollV( m_pCommanderView->ScrollAtV( nViewTopLine + nScrollNum ));
auto& caret = GetCaret();
auto prevCaretPos = caret.GetCaretLayoutPos();
caret.Cursor_UPDOWN( nScrollNum, bSelect );
auto currCaretPos = caret.GetCaretLayoutPos();
CLayoutInt nScrolled = m_pCommanderView->ScrollAtV( nViewTopLine + nScrollNum );
m_pCommanderView->SyncScrollV(nScrolled);
m_pCommanderView->SetDrawSwitch(bDrawSwitchOld);
// カーソル位置が変化しなかった、かつ、スクロール行数が0だった場合、描画を省く
if (prevCaretPos == currCaretPos && nScrolled == 0) {
return;
}
m_pCommanderView->RedrawAll();
}

Expand Down

0 comments on commit 2d2f3cb

Please sign in to comment.