- change: Ensure the line just below caret is visible while moving caret.

This commit is contained in:
Roy Qu 2023-10-23 17:36:10 +08:00
parent 7b9c5b378a
commit 00736ea73b
3 changed files with 6 additions and 4 deletions

View File

@ -12,6 +12,7 @@ Red Panda C++ Version 2.26
- fix: Link in the project options dialog / precompiled header pages is not clickable.
- change: Don't change caret position when ctrl+click.
- fix: Should cd to working directory when debugging.
- change: Ensure the line just below caret is visible while moving caret.
Red Panda C++ Version 2.25

View File

@ -1373,6 +1373,7 @@ void Editor::mouseReleaseEvent(QMouseEvent *event)
QString filename = mParser->getHeaderFileName(mFilename,s);
pMainWindow->openFile(filename);
return;
} else if (mParser->enabled()) {
gotoDefinition(p);
return;

View File

@ -3043,14 +3043,14 @@ void QSynEdit::ensureCursorPosVisibleEx(bool ForceToMiddle)
// Make sure Y is visible
int vCaretRow = displayY();
if (ForceToMiddle) {
if (vCaretRow < mTopLine || vCaretRow>(mTopLine + (mLinesInWindow - 1)))
if (vCaretRow < mTopLine || vCaretRow>(mTopLine + (mLinesInWindow - 2)))
setTopLine( vCaretRow - (mLinesInWindow - 1) / 2);
} else {
if (vCaretRow < mTopLine)
setTopLine(vCaretRow);
else if (vCaretRow > mTopLine + (mLinesInWindow - 1) && mLinesInWindow > 0)
setTopLine(vCaretRow - (mLinesInWindow - 1));
else
else if (vCaretRow > mTopLine + (mLinesInWindow - 2) && mLinesInWindow > 2) {
setTopLine(vCaretRow - (mLinesInWindow - 2) );
} else
setTopLine(mTopLine);
}
}