+ return false;
+}
+
+
+bool MathScriptInset::idxUpDown(LCursor & cur, bool up) const
+{
+ // in nucleus?
+ if (cur.idx() == 0) {
+ // don't go up/down if there is no cell in this direction
+ if (!has(up))
+ return false;
+ // go up/down only if in the last position
+ // or in the first position of something with displayed limits
+ if (cur.pos() == cur.lastpos() || (cur.pos() == 0 && hasLimits())) {
+ cur.idx() = idxOfScript(up);
+ cur.pos() = 0;
+ return true;
+ }
+ return false;
+ }
+
+ // Are we 'up'?
+ if (has(up) && cur.idx() == idxOfScript(true)) {
+ // can't go further up
+ if (up)
+ return false;
+ // otherwise go to last position in the nucleus
+ cur.idx() = 0;
+ cur.pos() = cur.lastpos();
+ return true;
+ }
+
+ // Are we 'down'?
+ if (has(up) && cur.idx() == idxOfScript(false)) {
+ // can't go further down
+ if (!up)
+ return false;
+ // otherwise go to last position in the nucleus
+ cur.idx() = 0;
+ cur.pos() = cur.lastpos();
+ return true;
+ }
+
+ return false;
+}
+
+
+void MathScriptInset::write(WriteStream & os) const
+{
+ if (nuc().size()) {
+ os << nuc();
+ //if (nuc().back()->takesLimits()) {