static void getParagraphList(DocRange const & range, ParagraphList & pars) { // Clone the paragraphs within the selection. pit_type startpit = range.from.pit(); pit_type endpit = range.to.pit(); ParagraphList const & ps_ = range.text()->paragraphs(); ParagraphList tmp_pars(next(ps_.begin(), startpit), next(ps_.begin(), endpit + 1)); // Remove the end of the last paragraph; afterwards, remove the // beginning of the first paragraph. Keep this order - there may only // be one paragraph! Paragraph & back = tmp_pars.back(); back.eraseChars(range.to.pos(), back.size(), false); Paragraph & front = tmp_pars.front(); front.eraseChars(0, range.from.pos(), false); pars.insert(pars.begin(), tmp_pars.begin(), tmp_pars.end()); }