X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FTextMetrics.cpp;h=ecc9e5219487d3015fde15ecb0d6aaf336fcb139;hb=3dfe917a4ed504de29ac18028936d02f856c92b1;hp=085040990dfe8f8da9089b0a291c901704f0b8a9;hpb=8d06c1ebda46477cccd2a0cde127c931e9ded1d7;p=lyx.git diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 085040990d..ecc9e52194 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -375,6 +375,21 @@ bool TextMetrics::redoParagraph(pit_type const pit) main_text_ = (text_ == &buffer.text()); bool changed = false; + // FIXME: This check ought to be done somewhere else. It is the reason + // why text_ is not const. But then, where else to do it? + // Well, how can you end up with either (a) a biblio environment that + // has no InsetBibitem or (b) a biblio environment with more than one + // InsetBibitem? I think the answer is: when paragraphs are merged; + // when layout is set; when material is pasted. + int const moveCursor = par.checkBiblio(buffer); + if (moveCursor > 0) + const_cast(bv_->cursor()).posForward(); + else if (moveCursor < 0) { + Cursor & cursor = const_cast(bv_->cursor()); + if (cursor.pos() >= -moveCursor) + cursor.posBackward(); + } + // Optimisation: this is used in the next two loops // so better to calculate that once here. int const right_margin = rightMargin(pm); @@ -401,6 +416,7 @@ bool TextMetrics::redoParagraph(pit_type const pit) InsetList::const_iterator ii = par.insetList().begin(); InsetList::const_iterator iend = par.insetList().end(); for (; ii != iend; ++ii) { + // FIXME Doesn't this HAVE to be non-empty? // position already initialized? if (!parPos.empty()) { parPos.pos() = ii->pos;