]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetListings.cpp
Revert "Do not crash is release mode if we stumble across an unrealized font."
[lyx.git] / src / insets / InsetListings.cpp
index ac31d28a0539b19209c41806ad3cac3b200f0e9d..1afa0f3612625d663e8500d65dbbcb5c3de9ce11 100644 (file)
@@ -30,6 +30,7 @@
 #include "output_xhtml.h"
 #include "OutputParams.h"
 #include "TextClass.h"
+#include "texstream.h"
 
 #include "support/debug.h"
 #include "support/docstream.h"
@@ -126,7 +127,7 @@ void InsetListings::latex(otexstream & os, OutputParams const & runparams) const
        // glyphs, except if full-unicode aware backends
        // such as XeTeX or LuaTeX are used, and with pLaTeX.
        bool const multibyte_possible = runparams.isFullUnicode()
-           || (buffer().params().bufferFormat() == "platex"
+           || (buffer().params().encoding().package() == Encoding::japanese
                && runparams.encoding->package() == Encoding::japanese);
 
        if (!multibyte_possible && !runparams.encoding->hasFixedWidth()) {
@@ -395,11 +396,14 @@ docstring InsetListings::getCaption(OutputParams const & runparams) const
        if (ins == 0)
                return docstring();
 
-       TexRow texrow;
        odocstringstream ods;
-       otexstream os(ods, texrow);
+       otexstream os(ods, false);
        ins->getArgs(os, runparams);
        ins->getArgument(os, runparams);
+
+       // TODO: The code below should be moved to support, and then the test
+       //       in ../tests should be moved there as well.
+
        // the caption may contain \label{} but the listings
        // package prefer caption={}, label={}
        docstring cap = ods.str();
@@ -414,7 +418,7 @@ docstring InsetListings::getCaption(OutputParams const & runparams) const
        //
        // NOTE that } is not allowed in blah2.
        regex const reg("(.*)\\\\label\\{(.*?)\\}(.*)");
-       string const new_cap("\\1\\3},label={\\2");
+       string const new_cap("$1$3},label={$2");
        return from_utf8(regex_replace(to_utf8(cap), reg, new_cap));
 }