]> git.lyx.org Git - lyx.git/blobdiff - src/Cursor.cpp
Fix language direction switch issue
[lyx.git] / src / Cursor.cpp
index 6412c0e2f712869bdcd8f5d98fb00f8908fd7d07..d2190e729fb44dc7364cc2c2526f2574e2d4e456 100644 (file)
@@ -2041,7 +2041,7 @@ bool Cursor::mathForward(bool word)
                                while (pos() < lastpos() && mc == nextMath().mathClass());
                } else if (openable(nextAtom())) {
                        InsetMathScript const * n = nextMath().asScriptInset();
-                       bool to_brace_deco = n
+                       bool to_brace_deco = n && !n->nuc().empty()
                                && n->nuc().back()->lyxCode() == MATH_DECORATION_CODE
                                && n->nuc().back()->mathClass() == MC_OP;
                        // single step: try to enter the next inset
@@ -2095,7 +2095,7 @@ bool Cursor::mathBackward(bool word)
                        }
                } else if (openable(prevAtom())) {
                        InsetMathScript const * p = prevMath().asScriptInset();
-                       bool to_brace_deco = p
+                       bool to_brace_deco = p && !p->nuc().empty()
                                && p->nuc().back()->lyxCode() == MATH_DECORATION_CODE
                                && p->nuc().back()->mathClass() == MC_OP;
                        // single step: try to enter the preceding inset
@@ -2216,7 +2216,7 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
                        if (updateNeeded)
                                forceBufferUpdate();
                }
-               return false;
+               return valid_destination;
        }
 
        // with and without selection are handled differently