for (pos_type j = 0; j < insertion[i].size(); ++j) {
if (insertion[i].isNewline(j)) {
// do not track deletion of newline
- insertion[i].erase(j, false);
+ insertion[i].eraseChar(j, false);
breakParagraphConservative(
buffer.params(),
insertion, i, j);
if (tmpbuf->getChar(i) == Paragraph::META_INSET &&
!pars[pit].insetAllowed(tmpbuf->getInset(i)->lyxCode()))
// do not track deletion of invalid insets
- tmpbuf->erase(i--, false);
+ tmpbuf->eraseChar(i--, false);
}
// FIXME: Change tracking (MG)
// Start and end is inside same paragraph
if (endpit == pit_type(pars.size()) ||
startpit == endpit) {
- endpos -= pars[startpit].erase(startpos, endpos);
+ endpos -= pars[startpit].eraseChars(startpos, endpos, false);
return PitPosPair(endpit, endpos);
}
pos_type const right = ( pit == endpit ? endpos :
pars[pit].size() + 1 );
// Logical erase only:
- pars[pit].erase(left, right);
+ pars[pit].eraseChars(left, right, false);
// Separate handling of para break:
if (merge && pit != endpit &&
(pit + 1 != endpit || pars[pit].hasSameLayout(pars[pit + 1]))) {
// Cut out the end of the last paragraph.
Paragraph & back = paragraphs.back();
- back.erase(end, back.size());
+ // do not track deletion here; it is an internal action not visible to the user
+ back.eraseChars(end, back.size(), false);
// Cut out the begin of the first paragraph
Paragraph & front = paragraphs.front();
- front.erase(0, start);
+ // again, do not track deletion
+ front.eraseChars(0, start, false);
theCuts.push(make_pair(paragraphs, tc));
}
namespace cap {
-string grabAndEraseSelection(LCursor & cur)
+docstring grabAndEraseSelection(LCursor & cur)
{
if (!cur.selection())
- return string();
- string res = grabSelection(cur);
+ return docstring();
+ docstring res = grabSelection(cur);
eraseSelection(cur);
return res;
}
// select the replacement
if (backwards) {
selbeg.pos() += str.length();
- cur.setSelection(selbeg, -str.length());
+ cur.setSelection(selbeg, -int(str.length()));
} else
cur.setSelection(selbeg, str.length());
}
}
-string grabSelection(LCursor const & cur)
+docstring grabSelection(LCursor const & cur)
{
if (!cur.selection())
- return string();
+ return docstring();
// FIXME: What is wrong with the following?
#if 0
MathArray::const_iterator it = i1.cell().begin();
return asString(MathArray(it + i1.pos(), it + i2.pos()));
} else {
- return "unknown selection 1";
+ return from_ascii("unknown selection 1");
}
}
InsetBase::col_type c1, c2;
region(i1, i2, r1, r2, c1, c2);
- string data;
+ docstring data;
if (i1.inset().asInsetMath()) {
for (InsetBase::row_type row = r1; row <= r2; ++row) {
if (row > r1)
}
}
} else {
- data = "unknown selection 2";
+ data = from_ascii("unknown selection 2");
}
return data;
}