From 67f9cbe6eead2e418a349115a3635afc032c737b Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sat, 23 Mar 2024 17:49:13 +0800 Subject: [PATCH] fix: scroll to last line --- libs/qsynedit/qsynedit/qsynedit.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/qsynedit/qsynedit/qsynedit.cpp b/libs/qsynedit/qsynedit/qsynedit.cpp index f2f4668f..d349dd14 100644 --- a/libs/qsynedit/qsynedit/qsynedit.cpp +++ b/libs/qsynedit/qsynedit/qsynedit.cpp @@ -3110,7 +3110,7 @@ void QSynEdit::updateHScrollbar() } if (mScrollBars == ScrollStyle::ssBoth || mScrollBars == ScrollStyle::ssHorizontal) { nMaxScroll = maxScrollWidth(); - nMin = 1; + nMin = 0; nMax = nMaxScroll; nPage = viewWidth(); nPos = mLeftPos; @@ -3144,7 +3144,7 @@ void QSynEdit::updateVScrollbar() if (mScrollBars == ScrollStyle::ssBoth || mScrollBars == ScrollStyle::ssVertical) { nMaxScroll = maxScrollHeight(); - nMin = 1; + nMin = 0; nMax = std::max(1, nMaxScroll); nPage = mLinesInWindow; nPos = mTopPos; @@ -6458,9 +6458,9 @@ void QSynEdit::dragLeaveEvent(QDragLeaveEvent *) int QSynEdit::maxScrollHeight() const { if (mOptions.testFlag(eoScrollPastEof)) - return std::max(displayLineCount(),1) * mTextHeight - 1; + return (std::max(displayLineCount(),1) - 1) * mTextHeight; else - return std::max((displayLineCount()-mLinesInWindow+1) * mTextHeight - 1 , 1) ; + return std::max((displayLineCount()-mLinesInWindow+1) * mTextHeight, 1) ; } bool QSynEdit::modified() const