// Redo paragraphs below cursor if necessary
int y2 = y0;
+ lyxerr << "y2 (1): " << y2 << endl;
while (y2 < bv.workHeight() && pit2 < int(npit) - 1) {
y2 += text->getPar(pit2).descent();
+ lyxerr << "y2 (2): " << y2 << endl;
++pit2;
text->redoParagraph(pit2);
y2 += text->getPar(pit2).ascent();
+ lyxerr << "y2 (3): " << y2 << endl;
}
// Take care of descent of last line
y2 += text->getPar(pit2).descent();
+ lyxerr << "text->getPar(pit2).descent(): " << text->getPar(pit2).descent() << endl;
+ lyxerr << "y2 (4): " << y2 << endl;
// The coordinates of all these paragraphs are correct, cache them
int y = y1;
+2005-02-14 André Pönitz <poenitz@gmx.net>
+
+ * dociterator.[Ch]: new member forwardPosNoDescent(),
+ which doesn't enter nested insets.
+ * text2.C (setFont): use forwardPosNoDescent() instead
+ of ForwardPos() (fixes crash on font change).
+
2005-02-13 Angus Leeming <leeming@lyx.org>
* lyx_main.C (init): invoke prependEnvPath to adjust the PATH
Paragraph & DocIterator::paragraph()
{
+ if (!inTexted())
+ lyxerr << *this << endl;
BOOST_ASSERT(inTexted());
return top().paragraph();
}
}
+void DocIterator::forwardPosNoDescend()
+{
+ CursorSlice & tip = top();
+ pos_type const lastp = lastpos();
+
+ // move on one position if possible
+ if (tip.pos() < lastp) {
+ //lyxerr << "... next pos" << endl;
+ ++tip.pos();
+ return;
+ }
+ //lyxerr << "... no next pos" << endl;
+
+ // otherwise move on one paragraph if possible
+ if (tip.pit() < lastpit()) {
+ //lyxerr << "... next par" << endl;
+ ++tip.pit();
+ tip.pos() = 0;
+ return;
+ }
+ //lyxerr << "... no next pit" << endl;
+
+ // otherwise try to move on one cell if possible
+ if (tip.idx() < lastidx()) {
+ //lyxerr << "... next idx" << endl;
+ ++tip.idx();
+ tip.pit() = 0;
+ tip.pos() = 0;
+ return;
+ }
+ //lyxerr << "... no next idx" << endl;
+
+ // otherwise we can't move on
+}
+
+
void DocIterator::forwardPar()
{
forwardPos();
//
// elementary moving
//
- /// move on one logical position
+ /// move on one logical position, do not descend into nested insets
+ void forwardPosNoDescend();
+ /// move on one logical position, descend into nested insets
void forwardPos();
/// move on one physical character or inset
void forwardChar();
// Don't use forwardChar here as ditend might have
// pos() == lastpos() and forwardChar would miss it.
- for (; dit != ditend; dit.forwardPos()) {
+ // Can't use forwardPos either as this descends into
+ // nested insets.
+ for (; dit != ditend; dit.forwardPosNoDescend()) {
if (dit.pos() != dit.lastpos()) {
LyXFont f = getFont(dit.paragraph(), dit.pos());
f.update(font, params.language, toggleall);