Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15.2
-
None
Description
After QTBUG-54787 (that was not resolved, but has a commit integrated in the releases), there is a regression of html appearance being changed when copying the text in the clipboard.
My comment in the initial bug got no response, so i am creating a new bug here.
If a table or a child <td> has the style "white-space: nowrap=true", now, when copied to clipboard, in QTextHtmlImporter::processBlockNode(), the block format now has NonBreakableLines attribute. Which seems legit as far as i understand.
But then, in QTextHtmlExporter::emitBlock(), because of that new attribute, the block is put inside of a <pre> instead of a <p> previously. <pre> indeed forbids text wrapping, but it also preformatted text with fixed width, and the formatting of the text that was inside is lost, so the html displayed when pasting this is different from the displayed html that was copied.
I think the condition in emitBlock()
const bool pre = blockFormat.nonBreakableLines();
is wrong, because indeed, pre has nowrap style the text in the <pre> actually is broken into multiple lines if the window is not wide. And nowrap style does not imply that we want <pre> formating. In my opinion, when nonBreakableLines() returns true, it would be more fitted to keep a <p> but with white-space: nowrap style
Attachments
Issue Links
- resulted from
-
QTBUG-54787 "white-space: nowrap" is not handled correctly in rich text
-
- Open
-