X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FParagraph.cpp;h=1b6a766fb54f6a7d289bc7eeb443260ff0f25c7f;hb=d9082639080b9de993742bd352f92e5183058cf5;hp=1116ad62b22d824da894f75232c3bd76804e82f6;hpb=c0a59871813d853ba455ec8d39be61db4f4b2848;p=lyx.git diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 1116ad62b2..1b6a766fb5 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -5,7 +5,7 @@ * * \author Asger Alstrup * \author Lars Gullik Bjønnes - * \author Richard Heck (XHTML output) + * \author Richard Kimberly Heck (XHTML output) * \author Jean-Marc Lasgouttes * \author Angus Leeming * \author John Levon @@ -1129,10 +1129,12 @@ void Paragraph::Private::latexSpecialChar(otexstream & os, { char_type const c = owner_->getUChar(bparams, runparams, i); - if (style.pass_thru || runparams.pass_thru + if (style.pass_thru || runparams.pass_thru || runparams.for_search || contains(style.pass_thru_chars, c) || contains(runparams.pass_thru_chars, c)) { - if (c != '\0') { + if ((c == '\\') && runparams.for_search) + os << "\\\\"; + else if (c != '\0') { Encoding const * const enc = runparams.encoding; if (enc && !enc->encodable(c)) throw EncodingException(c); @@ -2591,7 +2593,8 @@ void Paragraph::latex(BufferParams const & bparams, c == META_INSET && getInset(i) && getInset(i)->allowMultiPar() - && getInset(i)->lyxCode() != ERT_CODE; + && getInset(i)->lyxCode() != ERT_CODE + && getInset(i)->producesOutput(); bool closeLanguage = false; bool lang_switched_at_inset = false; @@ -2624,7 +2627,6 @@ void Paragraph::latex(BufferParams const & bparams, os << "}"; alien_script.clear(); } - bool needPar = false; if (in_ct_deletion) { // We have to close and then reopen \lyxdeleted, // as strikeout needs to be on lowest level. @@ -2635,6 +2637,7 @@ void Paragraph::latex(BufferParams const & bparams, // Force language closing current_font.setLanguage(basefont.language()); Font const nextfont = (i == body_pos-1) ? basefont : current_font; + bool needPar = false; column += running_font.latexWriteEndChanges( os, bparams, runparams, basefont, nextfont, needPar); @@ -2702,8 +2705,8 @@ void Paragraph::latex(BufferParams const & bparams, if (in_ct_deletion) { // We have to close and then reopen \lyxdeleted, // as strikeout needs to be on lowest level. - bool needPar = false; OutputParams rp = runparams; + bool needPar = false; column += running_font.latexWriteEndChanges( os, bparams, rp, basefont, basefont, needPar); @@ -2902,6 +2905,31 @@ void Paragraph::latex(BufferParams const & bparams, alien_script.clear(); } + Font const font = empty() + ? getLayoutFont(bparams, real_outerfont) + : getFont(bparams, size() - 1, real_outerfont); + + InsetText const * textinset = inInset().asInsetText(); + + bool const maintext = textinset + ? textinset->text().isMainText() + : false; + + size_t const numpars = textinset + ? textinset->text().paragraphs().size() + : 0; + + bool needPar = false; + + if (style.resfont.size() != font.fontInfo().size() + && (!runparams.isLastPar || maintext + || (numpars > 1 && d->ownerCode() != CELL_CODE + && (inInset().getLayout().isDisplay() + || parInline))) + && !style.isCommand()) { + needPar = true; + } + // If we have an open font definition, we have to close it if (open_font) { // Make sure that \\par is done with the font of the last @@ -2913,31 +2941,6 @@ void Paragraph::latex(BufferParams const & bparams, // We must not change the font for the last paragraph // of non-multipar insets, tabular cells or commands, // since this produces unwanted whitespace. - - Font const font = empty() - ? getLayoutFont(bparams, real_outerfont) - : getFont(bparams, size() - 1, real_outerfont); - - InsetText const * textinset = inInset().asInsetText(); - - bool const maintext = textinset - ? textinset->text().isMainText() - : false; - - size_t const numpars = textinset - ? textinset->text().paragraphs().size() - : 0; - - bool needPar = false; - - if (style.resfont.size() != font.fontInfo().size() - && (!runparams.isLastPar || maintext - || (numpars > 1 && d->ownerCode() != CELL_CODE - && (inInset().getLayout().isDisplay() - || parInline))) - && !style.isCommand()) { - needPar = true; - } #ifdef FIXED_LANGUAGE_END_DETECTION if (next_) { running_font.latexWriteEndChanges(os, bparams, @@ -2955,11 +2958,11 @@ void Paragraph::latex(BufferParams const & bparams, running_font.latexWriteEndChanges(os, bparams, runparams, basefont, basefont, needPar); #endif - if (needPar) { - // The \par could not be inserted at the same nesting - // level of the font size change, so do it now. - os << "{\\" << font.latexSize() << "\\par}"; - } + } + if (needPar) { + // The \par could not be inserted at the same nesting + // level of the font size change, so do it now. + os << "{\\" << font.latexSize() << "\\par}"; } column += Changes::latexMarkChange(os, bparams, runningChange,