]> git.lyx.org Git - lyx.git/blob - src/mathed/math_fracbase.C
fix out-of-bounds bug
[lyx.git] / src / mathed / math_fracbase.C
1 #ifdef __GNUG__
2 #pragma implementation
3 #endif
4
5 #include "math_fracbase.h"
6
7
8 MathFracbaseInset::MathFracbaseInset()
9         : MathNestInset(2)
10 {}
11
12
13 bool MathFracbaseInset::idxRight(MathInset::idx_type &,
14                                  MathInset::pos_type &) const
15 {
16         return false;
17 }
18
19
20 bool MathFracbaseInset::idxLeft(MathInset::idx_type &,
21                                 MathInset::pos_type &) const
22 {
23         return false;
24 }
25
26
27 bool MathFracbaseInset::idxUp(MathInset::idx_type & idx,
28                               MathInset::pos_type & pos) const
29 {
30         if (idx == 0)
31                 return false;
32         idx = 0;
33         pos = std::min(pos, cell(idx).size());
34         return true;
35 }
36
37
38 bool MathFracbaseInset::idxDown(MathInset::idx_type & idx,
39                                 MathInset::pos_type & pos) const
40 {
41         if (idx == 1)
42                 return false;
43         idx = 1;
44         pos = std::min(pos, cell(idx).size());
45         return true;
46 }