Commit ecfc66dc authored by Denis Kuplyakov's avatar Denis Kuplyakov

Fixed wrong section handling

Bug appear when one-paragraph section were moved
back to another section, due to paragraph-delimiter
deletion.
parent f4a7d803
......@@ -242,9 +242,23 @@ public:
}
} else { // m_endBlockNum != -1 in this case. We're pushing all new section info to the end block.
QTextBlockFormat fmt = cur->document()->findBlockByNumber(m_endBlockNum).blockFormat();
QList<KoSection *> allStartings = KoSectionUtils::sectionStartings(fmt);
fmt.clearProperty(KoParagraphStyle::SectionStartings);
closeList << KoSectionUtils::sectionEndings(fmt);
QList<KoSectionEnd *> pairedEndings;
QList<KoSectionEnd *> unpairedEndings;
foreach (KoSectionEnd *se, KoSectionUtils::sectionEndings(fmt)) {
KoSection *sec = se->correspondingSection();
if (allStartings.contains(sec)) {
pairedEndings << se;
} else {
unpairedEndings << se;
}
}
closeList = pairedEndings + closeList + unpairedEndings;
KoSectionUtils::setSectionStartings(fmt, openList);
KoSectionUtils::setSectionEndings(fmt, closeList);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment