]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/ref_inset.C
Jean-Marc's fix for wrong descent
[lyx.git] / src / mathed / ref_inset.C
index 570c7cf4c5d5981fe67300f7c1841f1fd2f8a385..ca7d8e67ec39a63b2f78c3e26fa7e32bd436c7f0 100644 (file)
@@ -54,6 +54,7 @@ RefInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
                                // Eventually trigger dialog with button 3
                                // not 1
                                ostringstream data;
+                               data << "ref LatexCommand ";
                                WriteStream wsdata(data);
                                write(wsdata);
                                wsdata << "\n\\end_inset\n\n";
@@ -132,7 +133,7 @@ int RefInset::docbook(std::ostream & os, bool) const
 
 dispatch_result RefInset::localDispatch(FuncRequest const & cmd)
 {
-       if (cmd.action != LFUN_REF_APPLY)
+       if (cmd.action != LFUN_INSET_MODIFY || cmd.getArg(0) != "ref")
                return UNDISPATCHED;
 
        MathArray ar;
@@ -150,10 +151,16 @@ dispatch_result RefInset::localDispatch(FuncRequest const & cmd)
 
 bool string2RefInset(string const & str, MathArray & ar)
 {
-       // str comes with a head "LatexCommand " and a
+       string name;
+       string body = split(str, name, ' ');
+
+       if (name != "ref")
+               return false;
+
+       // body comes with a head "LatexCommand " and a
        // tail "\nend_inset\n\n". Strip them off.
        string trimmed;
-       string body = split(str, trimmed, ' ');
+       body = split(body, trimmed, ' ');
        split(body, trimmed, '\n');
 
        mathed_parse_cell(ar, trimmed);