I tried to ask about this around but I have not received any answers. I apologize for false alarm if I'm doing anything wrong as I'm new to Qt. That said...
Please see the attached files. The problem is, when I try to remove some characters from QPlainTextEdit it corrupts the document. Specifically, I'm looping thought the text blocks and for each for them I remove first two characters from the line with removeSelectedText(), all operations are enclosed in one pair of beginEditBlock()/endEditBlock(). When the pair is disabled, the document stays in tact.