You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a limitation of the Qt framework. At the moment it is not possible to temporarily disable the QTextDocument's undo manager, nor is it possible for changes to block formats to not be recorded into the current undo command (unlike char formats, which can use QSyntaxHighlighter or QTextLayout::setFormats() to accomplish this).
As a result, the function FormattableTextArea::updateDocumentDefaults() deliberately clears the undo stack after a theme change so that it is not possible to corrupt the document by undoing the new theme's block formats.
There is no easy way to work around this. The only solution I can see is to disable QTextDocument's undo manager entirely and implement a custom undo manager, but that's an enormous amount of work for comparably little payoff. Hm...
The text was updated successfully, but these errors were encountered:
There should now be no char formats in the document (apart from char
formats for bold and italics) at any point. Everything is done either by
the document's default font options, the TextFormatter class, or
updatePaintNode() directly.
When pasting, the pasted HTML is now dissected and all non-bold
non-italics formats cleanly removed before it is passed on to the
QTextDocument.
When changing themes, we unfortunately still have to go through the
whole document and set the new block formats on each block one-by-one.
This is unavoidable due to the way QTextDocument is structured and the
fact that there is no way to access its individual block formats
(methods like QTextDocument::allFormats() only return copies).
This also results in some issues with the undo/redo system since you
can't exclude block format changes from the undo/redo system (see #51).
This is a limitation of the Qt framework. At the moment it is not possible to temporarily disable the
QTextDocument
's undo manager, nor is it possible for changes to block formats to not be recorded into the current undo command (unlike char formats, which can useQSyntaxHighlighter
orQTextLayout::setFormats()
to accomplish this).As a result, the function
FormattableTextArea::updateDocumentDefaults()
deliberately clears the undo stack after a theme change so that it is not possible to corrupt the document by undoing the new theme's block formats.There is no easy way to work around this. The only solution I can see is to disable
QTextDocument
's undo manager entirely and implement a custom undo manager, but that's an enormous amount of work for comparably little payoff. Hm...The text was updated successfully, but these errors were encountered: