]> git.lyx.org Git - lyx.git/blobdiff - src/Encoding.cpp
Amend 6c3447c8: FindAdv: sometimes a space is added on some math symbols
[lyx.git] / src / Encoding.cpp
index a4c706bd3b409b30a68e46ef4b3ca3f96fe2630e..2dd3c9de8f6fd1e06c70657716a9ad593bfb6f5c 100644 (file)
 
 #include "Encoding.h"
 
-#include "Lexer.h"
-
 #include "support/debug.h"
 #include "support/docstring.h"
 #include "support/gettext.h"
+#include "support/Lexer.h"
 #include "support/lstrings.h"
 #include "support/mutex.h"
 #include "support/textutils.h"
@@ -390,6 +389,9 @@ docstring Encodings::fromLaTeXCommand(docstring const & cmd, int cmdtype,
                                        docstring value;
                                        value += unicodeSymbol.first;
                                        needsTermination = !unicodeSymbol.second.mathNoTermination();
+                                       if (req && unicodeSymbol.second.mathFeature()
+                                               && !unicodeSymbol.second.mathPreamble().empty())
+                                                       req->insert(unicodeSymbol.second.mathPreamble());
                                        return value;
                                }
                        }
@@ -400,6 +402,9 @@ docstring Encodings::fromLaTeXCommand(docstring const & cmd, int cmdtype,
                                        docstring value;
                                        value += unicodeSymbol.first;
                                        needsTermination = !unicodeSymbol.second.textNoTermination();
+                                       if (req && unicodeSymbol.second.textFeature()
+                                               && !unicodeSymbol.second.textPreamble().empty())
+                                               req->insert(unicodeSymbol.second.textPreamble());
                                        return value;
                                }
                        }
@@ -453,13 +458,13 @@ docstring Encodings::fromLaTeXCommand(docstring const & cmd, int cmdtype,
                // the prefix of some command in the unicodesymbols file
                docstring subcmd = cmd.substr(i, j - i + 1);
 
-               CharInfoMap::const_iterator it = unicodesymbols.begin();
                // First part of subcmd which might be a combining character
                docstring combcmd = (m == j) ? docstring() : cmd.substr(i, m - i + 1);
                // The combining character of combcmd if it exists
-               CharInfoMap::const_iterator combining = uniend;
                size_t unicmd_size = 0;
                char_type c = 0;
+               CharInfoMap::const_iterator it = unicodesymbols.begin();
+               CharInfoMap::const_iterator combining = uniend;
                for (; it != uniend; ++it) {
                        if (it->second.deprecated())
                                continue;