Skip to content

Commit

Permalink
Merge pull request #1652 from beru/PageUp_PageDown_fix2
Browse files Browse the repository at this point in the history
先頭行でPageUp・末尾行でPageDownした後のカーソル移動で下線が残る不具合に対処
  • Loading branch information
beru authored Apr 30, 2021
2 parents 2e01db2 + 3a73b61 commit 62ef8ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 2 additions & 4 deletions sakura_core/cmd/CViewCommander_Cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,15 +745,14 @@ void CViewCommander::Command_1PageUp( bool bSelect, CLayoutYInt nScrollNum )
}
auto& caret = GetCaret();
auto prevCaretPos = caret.GetCaretLayoutPos();
bool bNoDispCursorVLine = m_pCommanderView->m_pTypeData->m_ColorInfoArr[COLORIDX_CURSORVLINE].m_bDisp == false;
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 (bNoDispCursorVLine && prevCaretPos == currCaretPos && nScrolled == 0) {
if (prevCaretPos == currCaretPos && nScrolled == 0) {
return;
}
m_pCommanderView->RedrawAll();
Expand Down Expand Up @@ -782,15 +781,14 @@ void CViewCommander::Command_1PageDown( bool bSelect, CLayoutYInt nScrollNum )
}
auto& caret = GetCaret();
auto prevCaretPos = caret.GetCaretLayoutPos();
bool bNoDispCursorVLine = m_pCommanderView->m_pTypeData->m_ColorInfoArr[COLORIDX_CURSORVLINE].m_bDisp == false;
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 (bNoDispCursorVLine && prevCaretPos == currCaretPos && nScrolled == 0) {
if (prevCaretPos == currCaretPos && nScrolled == 0) {
return;
}
m_pCommanderView->RedrawAll();
Expand Down
5 changes: 5 additions & 0 deletions sakura_core/view/CCaret.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,11 @@ CLayoutInt CCaret::Cursor_UPDOWN( CLayoutInt nMoveLines, bool bSelect )
bVertLineDoNotOFF = false;
}
GetAdjustCursorPos( &ptTo );

if (ptTo == ptCaret) {
return CLayoutInt(0);
}

if( bSelect ) {
/* 現在のカーソル位置によって選択範囲を変更 */
m_pEditView->GetSelectionInfo().ChangeSelectAreaByCurrentCursor( ptTo );
Expand Down

0 comments on commit 62ef8ab

Please sign in to comment.