X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetText.cpp;h=95d55b765b1c187d52bc0127d228c852e785019e;hb=39a9e370c71562c9b42690262698c1fc87c46b56;hp=fa1f40c7afa14a9a18d9556cb6ce7fee138906c2;hpb=6e8b3906df55826281a9ea9a8fd97bf5f7d98613;p=lyx.git diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index fa1f40c7af..95d55b765b 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -184,6 +184,15 @@ void InsetText::read(Lexer & lex) } +void InsetText::setOuterFont(BufferView & bv, FontInfo const & outer) const +{ + TextMetrics & tm = bv.textMetrics(&text_); + FontInfo tmpfont = getFont(); + tmpfont.realize(outer); + tm.font_.fontInfo() = tmpfont; +} + + void InsetText::metrics(MetricsInfo & mi, Dimension & dim) const { TextMetrics & tm = mi.base.bv->textMetrics(&text_); @@ -191,11 +200,13 @@ void InsetText::metrics(MetricsInfo & mi, Dimension & dim) const //lyxerr << "InsetText::metrics: width: " << mi.base.textwidth << endl; int const horiz_offset = leftOffset(mi.base.bv) + rightOffset(mi.base.bv); - - // Hand font through to contained lyxtext: - tm.font_.fontInfo() = mi.base.font; mi.base.textwidth -= horiz_offset; + // Remember the full outer font + setOuterFont(*mi.base.bv, mi.base.font); + // and use it in these metrics computation. + mi.base.font = tm.font_.fontInfo(); + // This can happen when a layout has a left and right margin, // and the view is made very narrow. We can't do better than // to draw it partly out of view (bug 5890). @@ -327,13 +338,14 @@ void InsetText::doDispatch(Cursor & cur, FuncRequest & cmd) || cmd.getArg(0) == insetName(lyxCode()); if (!main_inset && target_inset) { + UndoGroupHelper ugh(&buffer()); // Text::dissolveInset assumes that the cursor // is inside the Inset. - if (&cur.inset() != this) + if (&cur.inset() != this) { + cur.recordUndo(); cur.pushBackward(*this); - cur.beginUndoGroup(); + } text_.dispatch(cur, cmd); - cur.endUndoGroup(); } else cur.undispatched(); break; @@ -699,7 +711,7 @@ void InsetText::docbook(XMLStream & xs, OutputParams const & rp, XHTMLOptions op // No need for labels that are generated from counters. They should be handled by the external DocBook processor. // With respect to XHTML, paragraphs are still allowed here. - if (!allowMultiPar()) + if (runparams.docbook_consider_allow_multi_par && !allowMultiPar()) runparams.docbook_make_pars = false; if (il.isPassThru()) runparams.pass_thru = true; @@ -933,9 +945,11 @@ bool InsetText::hasCProtectContent(bool fragile) const bool InsetText::insetAllowed(InsetCode code) const { switch (code) { - // Arguments and (plain) quotes are also allowed in PassThru insets + // Arguments, (plain) quotes and counter insets + // are also allowed in PassThru insets case ARG_CODE: case QUOTE_CODE: + case COUNTER_CODE: return true; default: return !isPassThru();