+2001-01-26 Dekel Tsur <dekelts@tau.ac.il>
+
+ * math_parser.C (LexGetArg): Fix crash when loading corrupt files.
+
+ * formula.C (LocalDispatch): Before inserting a label in an
+ eqnarray, move the cursor to the top level.
+
+ * math_iter.C (getLabel): Test if crow == 0.
+
2001-01-15 Dekel Tsur <dekelts@tau.ac.il>
* math_draw.C (Metrics): Use the correct GetString.
// MathMatrixInset *mt = (MathMatrixInset*)par;
//BUG
// mt->SetNumbered(!mt->IsNumbered());
-
+
+#warning This is a terrible hack! We should find a better solution.
+ while (mathcursor->getLabel() == MathedXIter::error_label) {
+ if (LocalDispatch(bv, LFUN_LEFT, string()) == FINISHED)
+ return DISPATCHED;
+ }
mathcursor->setNumbered();
- UpdateLocal(bv);
+ UpdateLocal(bv);
}
break;
}
if (par->GetType() < LM_OT_PAR)
break;
- string old_label = (par->GetType() == LM_OT_MPARN)
+ string old_label = (par->GetType() == LM_OT_MPARN ||
+ par->GetType() == LM_OT_MPAR)
? mathcursor->getLabel() : label;
+
+#warning This is a terrible hack! We should find a better solution.
+ /// This is needed becuase in some positions mathcursor->cursor->crow
+ /// is equal to 0, and therefore the label cannot be inserted.
+ /// So we move the cursor left until mathcursor->cursor->crow != 0.
+ while (old_label == MathedXIter::error_label) {
+ if (LocalDispatch(bv, LFUN_LEFT, string()) == FINISHED)
+ return DISPATCHED;
+ old_label = mathcursor->getLabel();
+ }
+
string new_label = arg;
if (new_label.empty()) {
-#ifdef LABEL_INIT
string default_label = (lyxrc.label_init_length >= 0) ? "eq:" : "";
pair<bool, string> res = old_label.empty()
? askForText(_("Enter new label to insert:"), default_label)
-#else
- pair<bool, string> res = old_label.empty()
- ? askForText(_("Enter new label to insert:"))
-#endif
: askForText(_("Enter label:"), old_label);
if (!res.first)
break;
};
static lexcode_enum lexcode[256];
+#warning Replace with string
static char yytext[256];
static int yylineno;
static istream * yyis;
yyis->get(cc);
c = cc;
if (c > ' ') {
- if (!lf) lf = c; else
- if (c != lf)
+ if (!lf)
+ lf = c;
+ else if (c != lf) {
lyxerr << "Math parse error: unexpected '"
<< c << "'" << endl;
+ return '\0';
+ }
break;
}
}
if (c == lf) ++bcnt;
if (c == rg) --bcnt;
if ((c > ' ' || (c == ' ' && accept_spaces)) && bcnt > 0) *(p++) = c;
- } while (bcnt > 0 && yyis->good());
+ } while (bcnt > 0 && yyis->good() && p-yytext < 255);
*p = '\0';
return rg;
}
}
if (lexcode[c] == LexAlpha || lexcode[c] == LexDigit) {
char * p = &yytext[0];
- while (lexcode[c] == LexAlpha || lexcode[c] == LexDigit) {
+ while ((lexcode[c] == LexAlpha || lexcode[c] == LexDigit)
+ && p-yytext < 255) {
*p = c;
yyis->get(cc);
c = cc;