X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBufferView.cpp;h=d5ee51739c26aa8ffddf2034d4a96cdb706857d8;hb=cf15bd840b71a01ccbb2fbbbabc7066237b4bfd2;hp=33e157d58438a8084f47d16b51f2e5c57cca4547;hpb=8527a089035813a56a2963df56503216bff0eb04;p=lyx.git diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 33e157d584..d5ee51739c 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -768,7 +768,7 @@ void BufferView::showCursor(DocIterator const & dit) else if (bot_pit == tm.last().first + 1) tm.newParMetricsDown(); - if (tm.has(bot_pit)) { + if (tm.contains(bot_pit)) { ParagraphMetrics const & pm = tm.parMetrics(bot_pit); BOOST_ASSERT(!pm.rows().empty()); // FIXME: smooth scrolling doesn't work in mathed. @@ -1593,7 +1593,7 @@ void BufferView::gotoLabel(docstring const & label) { for (InsetIterator it = inset_iterator_begin(buffer_.inset()); it; ++it) { vector labels; - it->getLabelList(buffer_, labels); + it->getLabelList(labels); if (std::find(labels.begin(), labels.end(), label) != labels.end()) { setCursor(it); showCursor(); @@ -1802,6 +1802,10 @@ void BufferView::updateMetrics() if (d->inlineCompletionPos.fixIfBroken()) d->inlineCompletionPos = DocIterator(); + if (d->anchor_pit_ >= npit) + // The anchor pit must have been deleted... + d->anchor_pit_ = npit - 1; + // Rebreak anchor paragraph. tm.redoParagraph(d->anchor_pit_); ParagraphMetrics & anchor_pm = tm.par_metrics_[d->anchor_pit_]; @@ -1887,7 +1891,7 @@ void BufferView::insertLyXFile(FileName const & fname) el = buf.errorList("Parse"); buffer_.undo().recordUndo(d->cursor_); cap::pasteParagraphList(d->cursor_, buf.paragraphs(), - buf.params().getTextClassPtr(), el); + buf.params().documentClassPtr(), el); res = _("Document %1$s inserted."); } else { res = _("Could not insert document %1$s"); @@ -1995,7 +1999,7 @@ Point BufferView::getPos(DocIterator const & dit, bool boundary) const { CursorSlice const & bot = dit.bottom(); TextMetrics const & tm = textMetrics(bot.text()); - if (!tm.has(bot.pit())) + if (!tm.contains(bot.pit())) return Point(-1, -1); Point p = coordOffset(dit, boundary); // offset from outer paragraph @@ -2204,30 +2208,27 @@ void BufferView::setInlineCompletion(Cursor & cur, DocIterator const & pos, d->inlineCompletion = completion; d->inlineCompletionUniqueChars = min(completion.size(), uniqueChars); - lyxerr << "setInlineCompletion pos=" << pos << " completion=" << completion << " uniqueChars=" << uniqueChars << std::endl; + //lyxerr << "setInlineCompletion pos=" << pos << " completion=" << completion << " uniqueChars=" << uniqueChars << std::endl; // at new position? DocIterator const & old = d->inlineCompletionPos; if (old != pos) { - lyxerr << "inlineCompletionPos changed" << std::endl; + //lyxerr << "inlineCompletionPos changed" << std::endl; // old or pos are in another paragraph? if ((!samePar(cur, pos) && !pos.empty()) || (!samePar(cur, old) && !old.empty())) { singlePar = false; - lyxerr << "different paragraph" << std::endl; + //lyxerr << "different paragraph" << std::endl; } d->inlineCompletionPos = pos; } // set update flags if (changed) { - lyxerr << "inlineCompletion changed" << std::endl; - - Update::flags flags - = cur.disp_.update() | Update::Force; - if (singlePar && !(flags | Update::SinglePar)) - flags = flags | Update::SinglePar; - cur.updateFlags(flags); + if (singlePar && !(cur.disp_.update() & Update::Force)) + cur.updateFlags(cur.disp_.update() | Update::SinglePar); + else + cur.updateFlags(cur.disp_.update() | Update::Force); } }