}
-int InsetMathNest::latex(odocstream & os, OutputParams const & runparams) const
+int InsetMathNest::latex(otexstream & os, OutputParams const & runparams) const
{
- WriteStream wi(os, runparams.moving_arg, true,
+ WriteStream wi(os.os(), runparams.moving_arg, true,
runparams.dryrun ? WriteStream::wsDryrun : WriteStream::wsDefault,
runparams.encoding);
+ wi.canBreakLine(os.canBreakLine());
write(wi);
+ os.canBreakLine(wi.canBreakLine());
return wi.line();
}
}
case LFUN_REGEXP_MODE: {
- InsetMathHull * i = dynamic_cast<InsetMathHull *>(cur.inset().asInsetMath());
- if (i && i->getType() == hullRegexp) {
- cur.message(_("Already in regular expression mode"));
- break;
+ InsetMath * im = cur.inset().asInsetMath();
+ if (im) {
+ InsetMathHull * i = im->asHullInset();
+ if (i && i->getType() == hullRegexp) {
+ cur.message(_("Already in regular expression mode"));
+ break;
+ }
}
cur.macroModeClose();
docstring const save_selection = grabAndEraseSelection(cur);
if (have_l)
cur.insert(MathAtom(new InsetMathBig(lname,
ldelim)));
- cur.niceInsert(selection);
- if (have_r)
+ // first insert the right delimiter and then go back
+ // and re-insert the selection (bug 7088)
+ if (have_r) {
cur.insert(MathAtom(new InsetMathBig(rname,
rdelim)));
+ cur.posBackward();
+ }
+ cur.niceInsert(selection);
}
// Don't call cur.undispatched() if we did nothing, this would
// lead to infinite recursion via Text::dispatch().
string data;
if (name == "ref") {
InsetMathRef tmp(buffer_, name);
- data = tmp.createDialogStr(to_utf8(name));
+ data = tmp.createDialogStr();
cur.bv().showDialog(to_utf8(name), data);
} else if (name == "mathspace") {
cur.bv().showDialog(to_utf8(name));
break;
}
+ case LFUN_MATH_MODE:
+ // forbid "math-mode on" in math mode to prevent irritating
+ // behaviour of menu entries (bug 6709)
+ flag.setEnabled(currentMode() == TEXT_MODE || arg != "on");
+ break;
+
case LFUN_MATH_INSERT:
flag.setEnabled(currentMode() != TEXT_MODE);
break;
}
case LFUN_SPECIALCHAR_INSERT:
+ case LFUN_SCRIPT_INSERT:
// FIXME: These would probably make sense in math-text mode
flag.setEnabled(false);
break;
// position if needed
// cur.result().update(): don't overwrite previously set flags.
cur.screenUpdateFlags(Update::Decoration | Update::FitCursor
- | cur.result().update());
+ | cur.result().screenUpdate());
} else if (cmd.button() == mouse_button::button2) {
if (cap::selection()) {
// See comment in Text::dispatch why we do this
globals.push_back(from_ascii("\\cases"));
globals.push_back(from_ascii("\\substack"));
globals.push_back(from_ascii("\\xymatrix"));
+ globals.push_back(from_ascii("\\Diagram"));
globals.push_back(from_ascii("\\subarray"));
globals.push_back(from_ascii("\\array"));
globals.push_back(from_ascii("\\sqrt"));