TextDocumentLayout: bug fix for block count change

Example text that will make VNote crash:

```
ab123  aaa
```

Then select the space before `aaa` and press `Enter`.
This commit is contained in:
Le Tan 2018-11-07 20:31:21 +08:00
parent 64d2aab76a
commit c640118dfa

View File

@ -441,6 +441,7 @@ void VTextDocumentLayout::documentChanged(int p_from, int p_charsRemoved, int p_
// May be an invalid block.
QTextBlock changeEndBlock;
if (p_charsRemoved == p_charsAdded
&& newBlockCount == m_blockCount
&& changeStartBlock.position() == p_from
&& changeStartBlock.length() == p_charsAdded) {
// TODO: we may need one more next block.
@ -482,6 +483,8 @@ void VTextDocumentLayout::documentChanged(int p_from, int p_charsRemoved, int p_
updateOffset(changeStartBlock);
}
m_blockCount = newBlockCount;
updateDocumentSize();
// TODO: Update the view of all the blocks after changeStartBlock.