X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FCutAndPaste.cpp;h=5f3e8090fb524aa7d030309fe32e0bea46019da3;hb=fd3a41e035a44a66a3adcb9fa0f970f32e9d260c;hp=0bfd3ad4e91bcfbd1657e1170e59240794f313ee;hpb=b596330093d3fa5d80e3ffc185771df77a02393b;p=lyx.git diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index 0bfd3ad4e9..5f3e8090fb 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -387,7 +387,7 @@ pasteSelectionHelper(DocIterator const & cur, ParagraphList const & parlist, // Paste it! if (empty) { - pars.insert(next(pars.begin(), pit), + pars.insert(lyx::next(pars.begin(), pit), insertion.begin(), insertion.end()); @@ -395,7 +395,7 @@ pasteSelectionHelper(DocIterator const & cur, ParagraphList const & parlist, mergeParagraph(buffer.params(), pars, pit + insertion.size() - 1); } else { - pars.insert(next(pars.begin(), pit + 1), + pars.insert(lyx::next(pars.begin(), pit + 1), insertion.begin(), insertion.end()); @@ -599,8 +599,8 @@ void copySelectionHelper(Buffer const & buf, Text const & text, LASSERT(startpit != endpit || start <= end, return); // Clone the paragraphs within the selection. - ParagraphList copy_pars(next(pars.begin(), startpit), - next(pars.begin(), endpit + 1)); + ParagraphList copy_pars(lyx::next(pars.begin(), startpit), + lyx::next(pars.begin(), endpit + 1)); // Remove the end of the last paragraph; afterwards, remove the // beginning of the first paragraph. Keep this order - there may only @@ -811,22 +811,20 @@ vector availableSelections(Buffer const * buf) // we do not use cit-> here because gcc 2.9x does not // like it (JMarc) ParagraphList const & pars = (*cit).first; - docstring asciiSel; + docstring textSel; ParagraphList::const_iterator pit = pars.begin(); ParagraphList::const_iterator pend = pars.end(); for (; pit != pend; ++pit) { - Paragraph par(*pit, 0, 26); + Paragraph par(*pit, 0, 46); // adapt paragraph to current buffer. par.setBuffer(const_cast(*buf)); - asciiSel += par.asString(AS_STR_INSETS); - if (asciiSel.size() > 25) { - asciiSel.replace(22, docstring::npos, - from_ascii("...")); + textSel += par.asString(AS_STR_INSETS); + if (textSel.size() > 45) { + support::truncateWithEllipsis(textSel,45); break; } } - - selList.push_back(asciiSel); + selList.push_back(textSel); } return selList; @@ -963,20 +961,11 @@ void copySelectionToStack(Cursor const & cur, CutStack & cutstack) LBUFERR(text); // ok we have a selection. This is always between cur.selBegin() // and sel_end cursor - - // copy behind a space if there is one - ParagraphList & pars = text->paragraphs(); - pos_type pos = cur.selBegin().pos(); - pit_type par = cur.selBegin().pit(); - while (pos < pars[par].size() && - pars[par].isLineSeparator(pos) && - (par != cur.selEnd().pit() || pos < cur.selEnd().pos())) - ++pos; - - copySelectionHelper(*cur.buffer(), *text, par, cur.selEnd().pit(), - pos, cur.selEnd().pos(), - cur.buffer()->params().documentClassPtr(), cutstack); - + copySelectionHelper(*cur.buffer(), *text, + cur.selBegin().pit(), cur.selEnd().pit(), + cur.selBegin().pos(), cur.selEnd().pos(), + cur.buffer()->params().documentClassPtr(), + cutstack); // Reset the dirty_tabular_stack_ flag only when something // is copied to the clipboard (not to the selectionBuffer). if (&cutstack == &theCuts)