]> git.lyx.org Git - features.git/commitdiff
findadv: Output language chage in ANY case, if outputting for search
authorKornel Benko <kornel@lyx.org>
Sat, 3 Nov 2018 14:00:58 +0000 (15:00 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 12:39:50 +0000 (14:39 +0200)
Without this, the first \item entry in a list does not specify the language
in latex output. But we need it if we do not ignore language in search.

src/output_latex.cpp

index 532250ecef1ddf6990d48a4f1f344b3a7204b3a7..a81eb02ed77c5a204eab25ce3dbac31548dae413 100644 (file)
@@ -680,7 +680,7 @@ void parStartCommand(Paragraph const & par, otexstream & os,
        case LATEX_ITEM_ENVIRONMENT:
        case LATEX_LIST_ENVIRONMENT:
                if (runparams.for_search) {
-                       os << "\\item{" << style.latexname() << "}";
+                       os << "\\" + style.itemcommand() << "{" << style.latexname() << "}";
                }
                else {
                        os << "\\" + style.itemcommand();
@@ -875,12 +875,12 @@ void TeXOnePar(Buffer const & buf,
        bool const localswitch_needed = localswitch && par_lang != outer_lang;
 
        // localswitches need to be closed and reopened at each par
-       if ((par_lang != prev_lang || localswitch_needed)
+       if (runparams_in.for_search || ((par_lang != prev_lang || localswitch_needed)
             // check if we already put language command in TeXEnvironment()
             && !(style.isEnvironment()
                  && (pit == 0 || (priorpar->layout() != par.layout()
                                   && priorpar->getDepth() <= par.getDepth())
-                     || priorpar->getDepth() < par.getDepth()))) {
+                     || priorpar->getDepth() < par.getDepth())))) {
                if (!localswitch
                    && (!using_begin_end || langOpenedAtThisLevel(state))
                    && !lang_end_command.empty()