#include "BufferParams.h"
#include "debug.h"
-#include "LyXText.h"
+#include "Text.h"
#include "Paragraph.h"
#include "ParagraphParameters.h"
// without doing that we get a crash when typing <Return> at the
// end of a paragraph
- tmp->layout(bparams.getLyXTextClass().defaultLayout());
+ tmp->layout(bparams.getTextClass().defaultLayout());
// remember to set the inset_owner
tmp->setInsetOwner(par.inInset());
// Move over the end-of-par change information
tmp->setChange(tmp->size(), par.lookupChange(par.size()));
par.setChange(par.size(), Change(bparams.trackChanges ?
- Change::INSERTED : Change::UNCHANGED));
+ Change::INSERTED : Change::UNCHANGED));
if (pos) {
// Make sure that we keep the language when
if (!isempty) {
par.params().clear();
- par.layout(bparams.getLyXTextClass().defaultLayout());
+ par.layout(bparams.getTextClass().defaultLayout());
}
// layout stays the same with latex-environments
// Move over the end-of-par change information
tmp.setChange(tmp.size(), par.lookupChange(par.size()));
par.setChange(par.size(), Change(bparams.trackChanges ?
- Change::INSERTED : Change::UNCHANGED));
+ Change::INSERTED : Change::UNCHANGED));
}
}
pit_type pit = p;
depth_type par_depth = pars[p].getDepth();
while (pit != pit_type(pars.size())) {
- LyXLayout_ptr const & layout = pars[pit].layout();
+ Layout_ptr const & layout = pars[pit].layout();
int const endlabeltype = layout->endlabeltype;
if (endlabeltype != END_LABEL_NO_LABEL) {
}
+void acceptChanges(ParagraphList & pars, BufferParams const & bparams)
+{
+ pit_type pars_size = static_cast<pit_type>(pars.size());
+
+ // first, accept changes within each individual paragraph
+ // (do not consider end-of-par)
+ for (pit_type pit = 0; pit < pars_size; ++pit) {
+ if (!pars[pit].empty()) // prevent assertion failure
+ pars[pit].acceptChanges(bparams, 0, pars[pit].size());
+ }
+
+ // next, accept imaginary end-of-par characters
+ for (pit_type pit = 0; pit < pars_size; ++pit) {
+ pos_type pos = pars[pit].size();
+
+ if (pars[pit].isInserted(pos)) {
+ pars[pit].setChange(pos, Change(Change::UNCHANGED));
+ } else if (pars[pit].isDeleted(pos)) {
+ if (pit == pars_size - 1) {
+ // we cannot remove a par break at the end of the last
+ // paragraph; instead, we mark it unchanged
+ pars[pit].setChange(pos, Change(Change::UNCHANGED));
+ } else {
+ mergeParagraph(bparams, pars, pit);
+ --pit;
+ --pars_size;
+ }
+ }
+ }
+}
+
+
} // namespace lyx