diff options
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qplaintextedit.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index 20de404..03c36d7 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -573,7 +573,8 @@ QRectF QPlainTextEditControl::blockBoundingRect(const QTextBlock &block) const { if (!block.isValid()) return QRectF(); QRectF r = documentLayout->blockBoundingRect(currentBlock); - while (currentBlockNumber < blockNumber && offset.y() <= 2* textEdit->viewport()->height()) { + int maxVerticalOffset = r.height(); + while (currentBlockNumber < blockNumber && offset.y() - maxVerticalOffset <= 2* textEdit->viewport()->height()) { offset.ry() += r.height(); currentBlock = currentBlock.next(); ++currentBlockNumber; @@ -583,7 +584,7 @@ QRectF QPlainTextEditControl::blockBoundingRect(const QTextBlock &block) const { } r = documentLayout->blockBoundingRect(currentBlock); } - while (currentBlockNumber > blockNumber && offset.y() >= -textEdit->viewport()->height()) { + while (currentBlockNumber > blockNumber && offset.y() + maxVerticalOffset >= -textEdit->viewport()->height()) { currentBlock = currentBlock.previous(); --currentBlockNumber; while (!currentBlock.isVisible()) { |