summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qplaintextedit.cpp
diff options
context:
space:
mode:
authormae <qt-info@nokia.com>2011-02-23 14:46:34 +0100
committermae <qt-info@nokia.com>2011-02-23 14:54:52 +0100
commita2c10e7f58b1031a94c7a31ccf34cfd34e65f515 (patch)
treea02e7b1e5cd30e411e1dfeabcce1caa008a61da7 /src/gui/widgets/qplaintextedit.cpp
parentd9d68c383b7b1438d3034cd3708cfba5fb9706ef (diff)
Fix QPlainTextEdit corruption/crash with scrolling
There was an off-by-one error when QPlainTextEdit calculated the number of visible lines (not blocks) on the screne. When running into the error case, the number of visible lines was falsely 0 (not 1), which resulted in all softs of negative side effects as the scrollbar permitted the user to scroll behind the last paragraph. Task-number: QTBUG-17230 Reviewed-by: con
Diffstat (limited to 'src/gui/widgets/qplaintextedit.cpp')
-rw-r--r--src/gui/widgets/qplaintextedit.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index d3af9e197f..7435691bf0 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -967,7 +967,7 @@ void QPlainTextEditPrivate::_q_adjustScrollbars()
++lineNumber;
}
if (lineNumber < layoutLineCount)
- visibleFromBottom += (layoutLineCount - lineNumber - 1);
+ visibleFromBottom += (layoutLineCount - lineNumber);
break;
}