X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftext2.C;h=673287fbbb595796f0fedb4242fbf7cb15b9ebde;hb=3c851f1f7951f3a24b57826f3e580e4318b5e6c4;hp=6560c49310402c9a1e4e51dd90a3067b7604eeeb;hpb=8d88a0b2c93078db11f20e65c8695d74f7ad705d;p=lyx.git diff --git a/src/text2.C b/src/text2.C index 6560c49310..673287fbbb 100644 --- a/src/text2.C +++ b/src/text2.C @@ -440,7 +440,9 @@ void LyXText::setFont(LCursor & cur, LyXFont const & font, bool toggleall) // 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); @@ -791,8 +793,10 @@ void LyXText::setCounter(Buffer const & buf, pit_type pit) bool isOK = false; while (tmppit != end) { in = pars_[tmppit].inInset(); - if (in->lyxCode() == InsetBase::FLOAT_CODE || - in->lyxCode() == InsetBase::WRAP_CODE) { + // FIXME: in should be always valid. + if (in && + (in->lyxCode() == InsetBase::FLOAT_CODE || + in->lyxCode() == InsetBase::WRAP_CODE)) { isOK = true; break; } @@ -1246,9 +1250,6 @@ bool LyXText::cursorRight(LCursor & cur) if (cur.pos() != cur.lastpos()) { bool updateNeeded = false; if (!checkAndActivateInset(cur, true)) { - lyxerr << BOOST_CURRENT_FUNCTION - << " Running setCursor" << endl; - updateNeeded |= setCursor(cur, cur.pit(), cur.pos() + 1, true, false); if (false && bidi.isBoundary(cur.buffer(), cur.paragraph(), cur.pos()))