]> git.lyx.org Git - lyx.git/commitdiff
Fix bug #6564. The cmd status retrieval is quite broken within tables (math or text).
authorAbdelrazak Younes <younes@lyx.org>
Sat, 6 Mar 2010 14:19:21 +0000 (14:19 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sat, 6 Mar 2010 14:19:21 +0000 (14:19 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33639 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/InsetMathGrid.cpp

index a21c2f61e04dbf0224865bb94e5ba94b05a136da..7ce5858145bb47b72188a1aaef651319dcf604be 100644 (file)
@@ -1407,8 +1407,17 @@ bool InsetMathGrid::getStatus(Cursor & cur, FuncRequest const & cmd,
                istringstream is(to_utf8(cmd.argument()));
                string s;
                is >> s;
-               if (s != "tabular")
-                       return InsetMathNest::getStatus(cur, cmd, status);
+               if (s != "tabular") {
+                       // We only now about table actions here.
+                       break;
+               }
+               if (&cur.inset() != this) {
+                       // Table actions requires that the cursor is _inside_ the
+                       // table.
+                       status.setEnabled(false);
+                       status.message(from_utf8(N_("Cursor not in table")));
+                       return true;
+               }
                is >> s;
                if (nrows() <= 1 && (s == "delete-row" || s == "swap-row")) {
                        status.setEnabled(false);
@@ -1499,8 +1508,9 @@ bool InsetMathGrid::getStatus(Cursor & cur, FuncRequest const & cmd,
                return true;
 
        default:
-               return InsetMathNest::getStatus(cur, cmd, status);
+               break;
        }
+       return InsetMathNest::getStatus(cur, cmd, status);
 }