-
- recUndo(selection.start.par(), parOffset(undoendpit) - 1);
-
- endpit = getPar(selection.end.par());
- int endpos = selection.end.pos();
-
- BufferParams const & bufparams = bv()->buffer()->params();
- boost::tie(endpit, endpos) = realcut ?
- CutAndPaste::cutSelection(bufparams,
- ownerParagraphs(),
- getPar(selection.start.par()), endpit,
- selection.start.pos(), endpos,
- bufparams.textclass,
- doclear)
- : CutAndPaste::eraseSelection(bufparams,
- ownerParagraphs(),
- getPar(selection.start.par()), endpit,
- selection.start.pos(), endpos,
- doclear);
- // sometimes necessary
- if (doclear)
- getPar(selection.start.par())->stripLeadingSpaces();
-
- redoParagraphs(getPar(selection.start.par()), boost::next(endpit));
- // cutSelection can invalidate the cursor so we need to set
- // it anew. (Lgb)
- // we prefer the end for when tracking changes
- cursor.pos(endpos);
- cursor.par(parOffset(endpit));
-
- // need a valid cursor. (Lgb)
- clearSelection();
-
- setCursor(cursorPar(), cursor.pos());
- selection.cursor = cursor;
- updateCounters();
-}
-
-
-void LyXText::copySelection()
-{
- // stuff the selection onto the X clipboard, from an explicit copy request
- bv()->stuffClipboard(selectionAsString(*bv()->buffer(), true));
-
- // this doesnt make sense, if there is no selection
- if (!selection.set())
- return;
-
- // ok we have a selection. This is always between selection.start
- // and sel_end cursor
-
- // copy behind a space if there is one
- while (getPar(selection.start)->size() > selection.start.pos()
- && getPar(selection.start)->isLineSeparator(selection.start.pos())
- && (selection.start.par() != selection.end.par()
- || selection.start.pos() < selection.end.pos()))
- selection.start.pos(selection.start.pos() + 1);
-
- CutAndPaste::copySelection(getPar(selection.start.par()),
- getPar(selection.end.par()),
- selection.start.pos(), selection.end.pos(),
- bv()->buffer()->params().textclass);