Fix regression in QPlainTextEdit updating

It was incorrectly counting a block having more than one line as having
changed visibility.

Fixes: QTBUG-69310
Change-Id: I502cda1d3e8a4efb1c14122353cc0a4731d8581c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
bb10
Allan Sandfeld Jensen 2019-01-23 10:42:12 +01:00
parent 02280535be
commit fcba9fa861
1 changed files with 4 additions and 3 deletions

View File

@ -312,10 +312,11 @@ void QPlainTextDocumentLayout::documentChanged(int from, int charsRemoved, int c
QTextBlock block = changeStartBlock;
do {
block.clearLayout();
const int lineCount = block.isVisible() ? 1 : 0;
if (block.lineCount() != lineCount) {
if (block.isVisible()
? (block.lineCount() == 0)
: (block.lineCount() > 0)) {
blockVisibilityChanged = true;
block.setLineCount(lineCount);
block.setLineCount(block.isVisible() ? 1 : 0);
}
if (block == changeEndBlock)
break;