I can now reproduce bug 3225 http://bugzilla.lyx.org/show_bug.cgi?id=3225
This is tricky as this involved the dEPM mechanism somehow. The problem is that the leading empty space is erased (because par beginning with empty spaces are not allowed) but the CursorSlice corresponding to the is not updated. Here is the relevant portion of the code with some comments:
LyXFont LCursor::getFont() const { // HACK. far from being perfect... int s = 0; // go up until first non-0 text is hit // (innermost text is 0 in mathed) for (s = depth() - 1; s >= 0; --s) if (operator[](s).text()) --> The LyXText inside the caption is found here break; CursorSlice const & sl = operator[](s); --> at this point sl.pos() = 1 but whereas the pars size is one! LyXText const & text = *sl.text(); LyXFont font = text.getPar(sl.pit()).getFont( bv().buffer()->params(), sl.pos(), outerFont(sl.pit(), text.paragraphs())); return font; }