]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_scriptinset.C
small up/down tweaking
[lyx.git] / src / mathed / math_scriptinset.C
index 61bfd9fe01da7eeda8f383a4b513a8ccddbaf247..f94968fed4977d7314697239d5addfc17df544a5 100644 (file)
@@ -319,7 +319,7 @@ bool MathScriptInset::idxUpDown(idx_type & idx, pos_type & pos, bool up,
                        return false;
                // otherwise go to last base position
                idx = 2;
-               pos = cell(2).size();   
+               pos = cell(2).size();
        }
 
        else if (idx == 0) {
@@ -327,20 +327,22 @@ bool MathScriptInset::idxUpDown(idx_type & idx, pos_type & pos, bool up,
                if (!up)
                        return false;
                idx = 2;
-               pos = cell(2).size();   
+               pos = cell(2).size();
        }
-       
+
        else {
                // in nucleus
-               // don't go up/down unless in last position
-               if (pos != cell(2).size())
-                       return false;   
                // don't go up/down if there is no cell.
                if (!has(up))
                        return false;
-               // otherwise move into the first position
-               idx = up;
-               pos = 0;
+               // go up/down only if in the last position
+               // or in the first position of something with displayed limits
+               if (pos == cell(2).size() || (pos == 0 && hasLimits())) {
+                       idx = up;
+                       pos = 0;
+                       return true;
+               }
+               return false;
        }
        return true;
 }
@@ -417,18 +419,18 @@ void MathScriptInset::mathematicize(MathematicaStream & os) const
        bool u = hasUp() && up().size();
 
        if (nuc().size()) {
-               if (d) 
+               if (d)
                        os << "Subscript[" << nuc();
                else
                        os << nuc();
        }
 
        if (u)
-               os << "^(" << up() << ")";
+               os << "^(" << up() << ')';
 
        if (nuc().size())
                if (d)
-                       os << "," << down() << "]"; 
+                       os << ',' << down() << ']';
 }
 
 
@@ -472,6 +474,11 @@ void MathScriptInset::octavize(OctaveStream & os) const
 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");
 }