+ if (nuc().size())
+ os << nuc();
+ if (hasDown() && down().size())
+ os << '[' << down() << ']';
+ if (hasUp() && up().size())
+ os << "^(" << up() << ')';
+}
+
+
+void MathScriptInset::infoize(std::ostream & os) const
+{
+ os << "Scripts";
+}
+
+
+void MathScriptInset::infoize2(std::ostream & os) const
+{
+ if (limits_)
+ os << (limits_ == 1 ? ", Displayed limits" : ", Inlined limits");
+}
+
+
+void MathScriptInset::notifyCursorLeaves(LCursor & cur)
+{
+ MathNestInset::notifyCursorLeaves(cur);
+
+ // remove empty scripts if possible
+ if (nargs() > 2 && cur.idx() == 2 && cell(2).empty()) {
+ // must be a subscript...
+ removeScript(false);
+ // sanitize cursor, even if this slice will be removed immediately
+ cur.idx() = 0;
+ cur.pos() = 0;
+ } else if (nargs() > 1 && cur.idx() == 1 && cell(1).empty()) {
+ // could be either subscript or super script
+ removeScript(cell_1_is_up_);
+ // sanitize cursor, even if this slice will be removed immediately
+ cur.idx() = 0;
+ cur.pos() = 0;
+ }
+}
+
+
+void MathScriptInset::priv_dispatch(LCursor & cur, FuncRequest & cmd)
+{
+ //lyxerr << "MathScriptInset: request: " << cmd << std::endl;
+
+ if (cmd.action == LFUN_MATH_LIMITS) {
+ if (!cmd.argument.empty()) {
+ if (cmd.argument == "limits")
+ limits_ = 1;
+ else if (cmd.argument == "nolimits")
+ limits_ = -1;
+ else
+ limits_ = 0;
+ } else if (limits_ == 0)
+ limits_ = hasLimits() ? -1 : 1;
+ else
+ limits_ = 0;
+ return;
+ }
+
+ MathNestInset::priv_dispatch(cur, cmd);