]> git.lyx.org Git - lyx.git/blobdiff - src/Text.cpp
Run codespell on src/frontends
[lyx.git] / src / Text.cpp
index 4a447577f22c9e91d0139a739525d3a276f1538c..2be5b8602e31b831e765ea3f6081833709b6b4d3 100644 (file)
@@ -113,8 +113,7 @@ void breakParagraphConservative(BufferParams const & bparams,
        ParagraphList & pars, pit_type pit, pos_type pos)
 {
        // create a new paragraph
-       Paragraph & tmp = *pars.insert(lyx::next(pars.begin(), pit + 1),
-                                      Paragraph());
+       Paragraph & tmp = *pars.insert(pars.iterator_at(pit + 1), Paragraph());
        Paragraph & par = pars[pit];
 
        tmp.setInsetOwner(&par.inInset());
@@ -169,7 +168,7 @@ void mergeParagraph(BufferParams const & bparams,
        // move the change of the end-of-paragraph character
        par.setChange(par.size(), change);
 
-       pars.erase(lyx::next(pars.begin(), par_offset + 1));
+       pars.erase(pars.iterator_at(par_offset + 1));
 }
 
 
@@ -691,8 +690,7 @@ static void breakParagraph(Text & text, pit_type par_offset, pos_type pos,
        ParagraphList & pars = text.paragraphs();
        // create a new paragraph, and insert into the list
        ParagraphList::iterator tmp =
-               pars.insert(lyx::next(pars.begin(), par_offset + 1),
-                           Paragraph());
+               pars.insert(pars.iterator_at(par_offset + 1), Paragraph());
 
        Paragraph & par = pars[par_offset];
 
@@ -723,6 +721,7 @@ static void breakParagraph(Text & text, pit_type par_offset, pos_type pos,
 
                tmp->params().depth(par.params().depth());
                tmp->params().noindent(par.params().noindent());
+               tmp->params().spacing(par.params().spacing());
 
                // move everything behind the break position
                // to the new paragraph
@@ -1700,14 +1699,14 @@ bool Text::backspacePos0(Cursor & cur)
        if (cur.lastpos() == 0
            || (cur.lastpos() == 1 && par.isSeparator(0))) {
                cur.recordUndo(prevcur.pit());
-               plist.erase(lyx::next(plist.begin(), cur.pit()));
+               plist.erase(plist.iterator_at(cur.pit()));
                needsUpdate = true;
        }
        // is previous par empty?
        else if (prevcur.lastpos() == 0
                 || (prevcur.lastpos() == 1 && prevpar.isSeparator(0))) {
                cur.recordUndo(prevcur.pit());
-               plist.erase(lyx::next(plist.begin(), prevcur.pit()));
+               plist.erase(plist.iterator_at(prevcur.pit()));
                needsUpdate = true;
        }
        // FIXME: Do we really not want to allow this???
@@ -1799,9 +1798,7 @@ bool Text::dissolveInset(Cursor & cur)
        // save position inside inset
        pos_type spos = cur.pos();
        pit_type spit = cur.pit();
-       ParagraphList plist;
-       if (cur.lastpit() != 0 || cur.lastpos() != 0)
-               plist = paragraphs();
+       bool const inset_non_empty = cur.lastpit() != 0 || cur.lastpos() != 0;
        cur.popBackward();
        // update cursor offset
        if (spit == 0)
@@ -1814,7 +1811,8 @@ bool Text::dissolveInset(Cursor & cur)
        ++cur.pos();
 
        Buffer & b = *cur.buffer();
-       if (!plist.empty()) {
+       // Is there anything in this text?
+       if (inset_non_empty) {
                // see bug 7319
                // we clear the cache so that we won't get conflicts with labels
                // that get pasted into the buffer. we should update this before
@@ -1824,6 +1822,7 @@ bool Text::dissolveInset(Cursor & cur)
                // but we'll try the cheaper solution here.
                cur.buffer()->clearReferenceCache();
 
+               ParagraphList & plist = paragraphs();
                if (!lyxrc.ct_markup_copied)
                        // Do not revive deleted text
                        lyx::acceptChanges(plist, b.params());