}
+Buffer * Buffer::clone() const
+{
+ Buffer * clone = new Buffer(fileName().absFilename(), false);
+ clone->d->file_fully_loaded = true;
+ clone->d->params = d->params;
+ clone->d->inset = static_cast<InsetText *>(d->inset->clone());
+ clone->d->inset->setBuffer(*clone);
+ return clone;
+}
+
+
void Buffer::changed() const
{
if (d->wa_)
DocIterator const end = doc_iterator_end(this);
for (; from != end; from.forwardPos()) {
// We are only interested in text so remove the math CursorSlice.
- while (from.inMathed())
- from.forwardInset();
+ while (from.inMathed()) {
+ from.pop_back();
+ from.pos()++;
+ }
+ // If from is at the end of the document (which is possible
+ // when leaving the mathed) LyX will crash later.
+ if (from == end)
+ break;
to = from;
if (from.paragraph().spellCheck(from.pos(), to.pos(), wl, suggestions)) {
word_lang = wl;
break;
}
- from = to;
- ++progress;
+
+ // Do not increase progress when from == to, otherwise the word
+ // count will be wrong.
+ if (from != to) {
+ from = to;
+ ++progress;
+ }
}
return progress;
}