summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextmarkdownwriter_p.h
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2019-04-26 07:40:34 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2019-05-08 20:28:28 +0000
commit040dd7fe26bfa34aae19e2db698ff0d69346ed56 (patch)
tree180b60f5a9e171609fadabf6e36b81ad3337b2d0 /src/gui/text/qtextmarkdownwriter_p.h
parent6a58a68ae3feb27dca48ebb3274b748f784b3d12 (diff)
Markdown: fix several issues with lists and continuations
Importer fixes: - the first list item after a heading doesn't keep the heading font - the first text fragment after a bullet is the bullet text, not a separate paragraph - detect continuation lines and append to the list item text - detect continuation paragraphs and indent them properly - indent nested list items properly - add a test for QTextMarkdownImporter Writer fixes: - after bullet items, continuation lines and paragraphs are indented - indentation of continuations isn't affected by checkboxes - add extra newlines between list items in "loose" lists - avoid writing triple newlines - enhance the test for QTextMarkdownWriter Change-Id: Ib1dda514832f6dc0cdad177aa9a423a7038ac8c6 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Diffstat (limited to 'src/gui/text/qtextmarkdownwriter_p.h')
-rw-r--r--src/gui/text/qtextmarkdownwriter_p.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gui/text/qtextmarkdownwriter_p.h b/src/gui/text/qtextmarkdownwriter_p.h
index 2a9388ca2d..250288bcff 100644
--- a/src/gui/text/qtextmarkdownwriter_p.h
+++ b/src/gui/text/qtextmarkdownwriter_p.h
@@ -71,8 +71,19 @@ public:
void writeFrame(const QTextFrame *frame);
private:
+ struct ListInfo {
+ bool loose;
+ };
+
+ ListInfo listInfo(QTextList *list);
+
+private:
QTextStream &m_stream;
QTextDocument::MarkdownFeatures m_features;
+ QMap<QTextList *, ListInfo> m_listInfo;
+ int m_wrappedLineIndent = 0;
+ int m_lastListIndent = 1;
+ bool m_doubleNewlineWritten = false;
};
QT_END_NAMESPACE