]> git.lyx.org Git - features.git/commitdiff
*** empty log message ***
authorAndré Pönitz <poenitz@gmx.net>
Sat, 14 Aug 2004 21:03:55 +0000 (21:03 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Sat, 14 Aug 2004 21:03:55 +0000 (21:03 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8931 a592a061-630c-0410-9148-cb99ea01b6c8

src/dociterator.C
src/dociterator.h
src/mathed/math_nestinset.C
src/text3.C

index e8f4c0012b49898fa0bd4c88d2c79cca84a9b699..2df577b5f4adfffe1cc6caf21a2fcc57c700a139 100644 (file)
@@ -410,6 +410,17 @@ void DocIterator::backwardPos()
 }
 
 
+bool DocIterator::hasPart(DocIterator const & it) const
+{
+       // it can't be a part if it is larger
+       if (it.size() > size())
+               return false;
+
+       // as inset adresses are the 'last' level
+       return &it.back().inset() == &operator[](it.size() - 1).inset();
+}
+
+
 std::ostream & operator<<(std::ostream & os, DocIterator const & dit)
 {
        for (size_t i = 0, n = dit.size(); i != n; ++i)
index d00add62d478a4559379f282a2aa1f4de39ffadd..bb1f12832d040eaabb41d0e17293899816fee00e 100644 (file)
@@ -185,6 +185,9 @@ public:
        /// move backward one inset
        void backwardInset();
 
+       /// are we some 'extension' (i.e. deeper nested) of the given iterator
+       bool hasPart(DocIterator const & it) const;
+
        /// output
        friend std::ostream &
        operator<<(std::ostream & os, DocIterator const & cur);
index 3b82d0e65c73d126dd2e4c5dd3259ed6f226aa7d..f2986ee752fa38f36ea125c507a70146a79970db 100644 (file)
@@ -927,7 +927,7 @@ void MathNestInset::lfunMouseMotion(LCursor & cur, FuncRequest & cmd)
        if (cmd.button() == mouse_button::button1) {
                LCursor & bvcur = cur.bv().cursor();
                if (abs(cmd.x - first_x) + abs(cmd.y - first_y) > 4
-        && cur.size() <= bvcur.anchor_.size()) {
+        && bvcur.anchor_.hasPart(cur)) {
                        first_x = cmd.x;
                        first_y = cmd.y;
 
index 3900a13a111748011204fc38fd5f37d00484def6..0b230da156c4c545db65166b2b586e8955691fb3 100644 (file)
@@ -1129,9 +1129,9 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
 
                // ignore motions deeper nested than the real anchor
                LCursor & bvcur = cur.bv().cursor();
-               if (bvcur.anchor_.size() < cur.size())
+               if (!bvcur.anchor_.hasPart(cur))
                        break;
-
                CursorSlice old = cur.top();
                setCursorFromCoordinates(cur, cmd.x, cmd.y);