]> git.lyx.org Git - lyx.git/blobdiff - src/support/lstrings.cpp
Added distribution of a missing file used by tests.
[lyx.git] / src / support / lstrings.cpp
index 99591d0c4dd495483bd6bbdeadea2d771385d1ea..8ffab19c7ef14b9a8f2a4fe0b3cbd371ac68e3ff 100644 (file)
@@ -1180,7 +1180,8 @@ docstring const escape(docstring const & lab)
        for (size_t i = 0; i < lab.length(); ++i) {
                char_type c = lab[i];
                if (c >= 128 || c == '=' || c == '%' || c == '#' || c == '$'
-                   || c == '}' || c == '{' || c == ']' || c == '[' || c == '&') {
+                   || c == '}' || c == '{' || c == ']' || c == '[' || c == '&'
+                   || c == '\\') {
                        // Although char_type is a 32 bit type we know that
                        // UCS4 occupies only 21 bits, so we don't need to
                        // encode bigger values. Test for 2^24 because we
@@ -1202,6 +1203,16 @@ docstring const escape(docstring const & lab)
 }
 
 
+docstring const protectArgument(docstring & arg, char const l,
+                         char const r)
+{
+       if (contains(arg, l) || contains(arg, r))
+               // protect brackets
+               arg = '{' + arg + '}';
+       return arg;
+}
+
+
 bool truncateWithEllipsis(docstring & str, size_t const len)
 {
        if (str.size() <= len)