fix: indent line pos
change: align text with editor up-side when moving caret
This commit is contained in:
parent
2dd570cb08
commit
e1b716200d
|
@ -818,7 +818,7 @@ void QSynEditPainter::paintFoldAttributes()
|
||||||
break;
|
break;
|
||||||
int X;
|
int X;
|
||||||
// Set vertical coord
|
// Set vertical coord
|
||||||
int Y = (row - mEdit->yposToRow(0)) * mEdit->mTextHeight; // limit inside clip rect
|
int Y = (row-1) * mEdit->mTextHeight - mEdit->mTopPos; // limit inside clip rect
|
||||||
if (mEdit->mTextHeight % 2 == 1 && vLine % 2 == 0) {
|
if (mEdit->mTextHeight % 2 == 1 && vLine % 2 == 0) {
|
||||||
Y++;
|
Y++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2986,7 +2986,11 @@ void QSynEdit::ensureCaretVisibleEx(bool ForceToMiddle)
|
||||||
if ((vCaretRow-1) * mTextHeight < mTopPos)
|
if ((vCaretRow-1) * mTextHeight < mTopPos)
|
||||||
setTopPos( (vCaretRow - 1) * mTextHeight);
|
setTopPos( (vCaretRow - 1) * mTextHeight);
|
||||||
else if (vCaretRow * mTextHeight > mTopPos + clientHeight() ) {
|
else if (vCaretRow * mTextHeight > mTopPos + clientHeight() ) {
|
||||||
setTopPos( vCaretRow * mTextHeight - clientHeight());
|
int value = vCaretRow * mTextHeight - clientHeight();
|
||||||
|
int offset = value % mTextHeight;
|
||||||
|
if (offset!=0)
|
||||||
|
value += (mTextHeight - offset);
|
||||||
|
setTopPos(value);
|
||||||
} else
|
} else
|
||||||
setTopPos(mTopPos);
|
setTopPos(mTopPos);
|
||||||
}
|
}
|
||||||
|
@ -6810,6 +6814,7 @@ void QSynEdit::setLeftPos(int value)
|
||||||
//int MaxVal;
|
//int MaxVal;
|
||||||
//QRect iTextArea;
|
//QRect iTextArea;
|
||||||
value = std::min(value,maxScrollWidth());
|
value = std::min(value,maxScrollWidth());
|
||||||
|
value = std::max(value, 0);
|
||||||
if (value != mLeftPos) {
|
if (value != mLeftPos) {
|
||||||
horizontalScrollBar()->setValue(value);
|
horizontalScrollBar()->setValue(value);
|
||||||
setStatusChanged(StatusChange::scLeftPos);
|
setStatusChanged(StatusChange::scLeftPos);
|
||||||
|
@ -6829,7 +6834,7 @@ int QSynEdit::topPos() const
|
||||||
void QSynEdit::setTopPos(int value)
|
void QSynEdit::setTopPos(int value)
|
||||||
{
|
{
|
||||||
value = std::min(value,maxScrollHeight());
|
value = std::min(value,maxScrollHeight());
|
||||||
value = std::max(value, 1);
|
value = std::max(value, 0);
|
||||||
if (value != mTopPos) {
|
if (value != mTopPos) {
|
||||||
verticalScrollBar()->setValue(value);
|
verticalScrollBar()->setValue(value);
|
||||||
setStatusChanged(StatusChange::scTopPos);
|
setStatusChanged(StatusChange::scTopPos);
|
||||||
|
|
Loading…
Reference in New Issue