]> git.lyx.org Git - lyx.git/blobdiff - src/CutAndPaste.cpp
Support halfline and fullline also in vspace.
[lyx.git] / src / CutAndPaste.cpp
index 0e620aab8ace717858849652b242a27c9475145d..86e2432947d601435c744415e29589e58c0aa2b3 100644 (file)
@@ -462,17 +462,15 @@ pasteSelectionHelper(DocIterator const & cur, ParagraphList const & parlist,
 
        // Paste it!
        if (empty) {
-               pars.insert(lyx::next(pars.begin(), pit),
-                           insertion.begin(),
-                           insertion.end());
+               pars.insert(pars.iterator_at(pit),
+                           insertion.begin(), insertion.end());
 
                // merge the empty par with the last par of the insertion
                mergeParagraph(buffer.params(), pars,
                               pit + insertion.size() - 1);
        } else {
-               pars.insert(lyx::next(pars.begin(), pit + 1),
-                           insertion.begin(),
-                           insertion.end());
+               pars.insert(pars.iterator_at(pit + 1),
+                           insertion.begin(), insertion.end());
 
                // merge the first par of the insertion with the current par
                mergeParagraph(buffer.params(), pars, pit);
@@ -604,7 +602,7 @@ Buffer * copyToTempBuffer(ParagraphList const & paragraphs, DocumentClassConstPt
 
 void putClipboard(ParagraphList const & paragraphs,
                  DocumentClassConstPtr docclass, docstring const & plaintext,
-                 BufferParams const bp)
+                 BufferParams const bp)
 {
        Buffer * buffer = copyToTempBuffer(paragraphs, docclass);
        if (!buffer) // already asserted in copyToTempBuffer()
@@ -683,8 +681,8 @@ void copySelectionHelper(Buffer const & buf, Text const & text,
        LASSERT(startpit != endpit || start <= end, return);
 
        // Clone the paragraphs within the selection.
-       ParagraphList copy_pars(lyx::next(pars.begin(), startpit),
-                               lyx::next(pars.begin(), endpit + 1));
+       ParagraphList copy_pars(pars.iterator_at(startpit),
+                               pars.iterator_at(endpit + 1));
 
        // Remove the end of the last paragraph; afterwards, remove the
        // beginning of the first paragraph. Keep this order - there may only
@@ -887,8 +885,6 @@ vector<docstring> availableSelections(Buffer const * buf)
                return selList;
 
        for (auto const & cut : theCuts) {
-               // we do not use cit-> here because gcc 2.9x does not
-               // like it (JMarc)
                ParagraphList const & pars = cut.first;
                docstring textSel;
                for (auto const & para : pars) {
@@ -1221,9 +1217,7 @@ bool pasteClipboardText(Cursor & cur, ErrorList & errorList, bool asParagraphs,
            theClipboard().hasTextContents(Clipboard::LyXTextType)) {
                string lyx = theClipboard().getAsLyX();
                if (!lyx.empty()) {
-                       // For some strange reason gcc 3.2 and 3.3 do not accept
-                       // Buffer buffer(string(), false);
-                       Buffer buffer("", false);
+                       Buffer buffer(string(), false);
                        buffer.setUnnamed(true);
                        if (buffer.readString(lyx)) {
                                cur.recordUndo();
@@ -1254,9 +1248,7 @@ bool pasteClipboardText(Cursor & cur, ErrorList & errorList, bool asParagraphs,
                        docstring text = theClipboard().getAsText(types[i]);
                        available = !text.empty();
                        if (available) {
-                               // For some strange reason gcc 3.2 and 3.3 do not accept
-                               // Buffer buffer(string(), false);
-                               Buffer buffer("", false);
+                               Buffer buffer(string(), false);
                                buffer.setUnnamed(true);
                                available = buffer.importString(names[i], text, errorList);
                                if (available)
@@ -1364,8 +1356,10 @@ void replaceSelectionWithString(Cursor & cur, docstring const & str)
        // Insert the new string
        pos_type pos = cur.selEnd().pos();
        Paragraph & par = cur.selEnd().paragraph();
-       for (auto const & c : str)
+       for (auto const & c : str) {
                par.insertChar(pos, c, font, cur.buffer()->params().track_changes);
+               ++pos;
+       }
 
        // Cut the selection
        cutSelection(cur, false);