]> git.lyx.org Git - features.git/blobdiff - src/mathed/InsetMathNest.cpp
Now Adv. F&R correctly interprets escape sequences within regexp insets, e.g., \...
[features.git] / src / mathed / InsetMathNest.cpp
index 60c49b27b59be8d07d07c3fb0ae6fd9aeccc7320..9dd01cca0c66562c8516596f58f5d29858ab05a2 100644 (file)
@@ -1724,7 +1724,29 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
        }
 
        // These should be treated differently when not in text mode:
-       if (currentMode() != InsetMath::TEXT_MODE) {
+       if (cur.inRegexped()) {
+               switch (c) {
+               case '\\':
+                       cur.niceInsert(createInsetMath("backslash", buf));
+                       break;
+               case '^':
+                       cur.niceInsert(createInsetMath("mathcircumflex", buf));
+                       break;
+               case '{':
+               case '}':
+               case '#':
+               case '%':
+               case '_':
+                       cur.niceInsert(createInsetMath(docstring(1, c), buf));
+                       break;
+               case '~':
+                       cur.niceInsert(createInsetMath("sim", buf));
+                       break;
+               default:
+                       cur.insert(c);
+               }
+               return true;
+       } else if (currentMode() != InsetMath::TEXT_MODE) {
                if (c == '_') {
                        script(cur, false, save_selection);
                        return true;