]> git.lyx.org Git - features.git/commitdiff
* InsetCommandParams.cpp (prepareCommand):
authorJürgen Spitzmüller <spitz@lyx.org>
Thu, 21 Oct 2010 13:16:28 +0000 (13:16 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Thu, 21 Oct 2010 13:16:28 +0000 (13:16 +0000)
- properly terminate LaTeX macros (reported in bug 6959).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35746 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetCommandParams.cpp

index 87084c3ee9a3c27f2311b9e0358faa27b903466d..31ea514a79549aa9a835d2dfb338be258e5d3e05 100644 (file)
@@ -375,7 +375,15 @@ docstring InsetCommandParams::prepareCommand(OutputParams const & runparams,
                docstring uncodable;
                for (size_t n = 0; n < command.size(); ++n) {
                        try {
-                               result += runparams.encoding->latexChar(command[n]);
+                               char_type const c = command[n];
+                               docstring const latex = runparams.encoding->latexChar(c);
+                               result += latex;
+                               if (latex.length() > 1 && latex[latex.length() - 1] != '}') {
+                                       // Prevent eating of a following
+                                       // space or command corruption by
+                                       // following characters
+                                       result +=  "{}";
+                               }
                        } catch (EncodingException & /* e */) {
                                LYXERR0("Uncodable character in command inset!");
                                if (runparams.dryrun) {