mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
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:
parent
64d2aab76a
commit
c640118dfa
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user