]> git.lyx.org Git - lyx.git/blobdiff - src/Encoding.cpp
Backport 33284ee5c.
[lyx.git] / src / Encoding.cpp
index e0b3b70789e144a7c80a69507615d3c4f3e45ad2..96e35ecbb707e04e75fee87cb30211fbbdc8173e 100644 (file)
@@ -25,8 +25,9 @@
 
 #include <boost/cstdint.hpp>
 
-#include <sstream>
+#include <iterator>
 #include <algorithm>
+#include <sstream>
 
 using namespace std;
 using namespace lyx::support;
@@ -58,7 +59,7 @@ MathAlphaSet mathalpha;
 /// The highest code point in UCS4 encoding (1<<20 + 1<<16)
 char_type const max_ucs4 = 0x110000;
 
-} // namespace anon
+} // namespace
 
 
 EncodingException::EncodingException(char_type c)
@@ -263,11 +264,15 @@ vector<char_type> Encoding::symbolsList() const
        vector<char_type> symbols;
        for (char_type c = 0; c < start_encodable_; ++c)
                symbols.push_back(c);
-       //add all encodable characters
+       // add all encodable characters
        copy(encodable_.begin(), encodable_.end(), back_inserter(symbols));
-       // now the ones from the unicodesymbols file
-       for (pair<char_type, CharInfo> const & elem : unicodesymbols)
-               symbols.push_back(elem.first);
+       // now the ones from the unicodesymbols file that are not already there
+       for (pair<char_type, CharInfo> const & elem : unicodesymbols) {
+               if (find(symbols.begin(), symbols.end(), elem.first) == symbols.end())
+                       symbols.push_back(elem.first);
+       }
+       // finally, sort the vector
+       sort(symbols.begin(), symbols.end());
        return symbols;
 }