]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_nestinset.C
fix compile problem
[lyx.git] / src / mathed / math_nestinset.C
index 9f501423e97d8966cc4a1715c42c3558a9784018..6a6ceb3e7017e6e2c8ff69e08c025206748c6dd1 100644 (file)
@@ -25,6 +25,7 @@
 #include "math_parser.h"
 #include "math_scriptinset.h"
 #include "math_spaceinset.h"
+#include "math_symbolinset.h"
 #include "math_support.h"
 #include "math_unknowninset.h"
 
 #include "outputparams.h"
 #include "undo.h"
 
-#include "support/std_sstream.h"
 #include "support/lstrings.h"
 
 #include "frontends/Dialogs.h"
 #include "frontends/LyXView.h"
 #include "frontends/Painter.h"
 
+#include <sstream>
+
 using lyx::cap::copySelection;
 using lyx::cap::grabAndEraseSelection;
 using lyx::cap::cutSelection;
@@ -440,9 +442,8 @@ void MathNestInset::priv_dispatch(LCursor & cur, FuncRequest & cmd)
                cur.selHandle(cmd.action == LFUN_RIGHTSEL);
                cur.autocorrect() = false;
                cur.clearTargetX();
-               if (cur.inMacroMode())
-                       cur.macroModeClose();
-               else if (cur.pos() != cur.lastpos() && cur.openable(cur.nextAtom())) {
+               cur.macroModeClose();
+               if (cur.pos() != cur.lastpos() && cur.openable(cur.nextAtom())) {
                        cur.pushLeft(*cur.nextAtom().nucleus());
                        cur.inset().idxFirst(cur);
                } else if (cur.posRight() || idxRight(cur)
@@ -457,9 +458,8 @@ void MathNestInset::priv_dispatch(LCursor & cur, FuncRequest & cmd)
                cur.selHandle(cmd.action == LFUN_LEFTSEL);
                cur.autocorrect() = false;
                cur.clearTargetX();
-               if (cur.inMacroMode())
-                       cur.macroModeClose();
-               else if (cur.pos() != 0 && cur.openable(cur.prevAtom())) {
+               cur.macroModeClose();
+               if (cur.pos() != 0 && cur.openable(cur.prevAtom())) {
                        cur.posLeft();
                        cur.push(*cur.nextAtom().nucleus());
                        cur.inset().idxLast(cur);
@@ -1005,6 +1005,9 @@ bool MathNestInset::interpret(LCursor & cur, char c)
                        } else if (c == '{') {
                                cur.backspace();
                                cur.niceInsert(MathAtom(new MathBraceInset));
+                       } else if (c == '%') {
+                               cur.backspace();
+                               cur.niceInsert(MathAtom(new MathCommentInset));
                        } else if (c == '#') {
                                lyxerr << "setting name to " << name + c << endl;
                                BOOST_ASSERT(cur.activeMacro());
@@ -1087,13 +1090,13 @@ bool MathNestInset::interpret(LCursor & cur, char c)
                return true;
        }
 
-       if (c == '{' || c == '}' || c == '&' || c == '$' || c == '#') {
+       if (c == '{' || c == '}' || c == '&' || c == '$' || c == '#' || c == '%') {
                cur.niceInsert(createMathInset(string(1, c)));
                return true;
        }
 
-       if (c == '%') {
-               cur.niceInsert(MathAtom(new MathCommentInset));
+       if (c == '~') {
+               cur.niceInsert(createMathInset("sim"));
                return true;
        }
 
@@ -1110,7 +1113,7 @@ bool MathNestInset::interpret(LCursor & cur, char c)
 
 bool MathNestInset::script(LCursor & cur, bool up)
 {
-       // Hack to get \\^ and \\_ working
+       // Hack to get \^ and \_ working
        lyxerr << "handling script: up: " << up << endl;
        if (cur.inMacroMode() && cur.macroName() == "\\") {
                if (up)