]> git.lyx.org Git - features.git/commitdiff
a small cleanup, a tiny optimization and a comment.
authorAbdelrazak Younes <younes@lyx.org>
Thu, 9 Nov 2006 10:13:13 +0000 (10:13 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Thu, 9 Nov 2006 10:13:13 +0000 (10:13 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15817 a592a061-630c-0410-9148-cb99ea01b6c8

src/text2.C

index 16ca5c565b5a31afc8fff04f7a4aba2fe71d20a5..7dcc542d63aadffa2033a2153388a3b0e55db1dc 100644 (file)
@@ -970,7 +970,8 @@ InsetBase * LyXText::editXY(LCursor & cur, int x, int y)
        bool bound = false;
 
        int xx = x; // is modified by getColumnNearX
-       pos_type const pos = row.pos() + getColumnNearX(cur.bv(), pit, row, xx, bound);
+       pos_type const pos = row.pos()
+               + getColumnNearX(cur.bv(), pit, row, xx, bound);
        cur.pit() = pit;
        cur.pos() = pos;
        cur.boundary(bound);
@@ -986,18 +987,22 @@ InsetBase * LyXText::editXY(LCursor & cur, int x, int y)
                return 0;
        }
 
+       InsetBase * insetBefore = pars_[pit].getInset(pos - 1);
+       //InsetBase * insetBehind = pars_[pit].getInset(pos);
+
        // This should be just before or just behind the
        // cursor position set above.
-        InsetBase * inset2 = pars_[pit].getInset(pos - 1);
-        InsetBase * inset3 = pars_[pit].getInset(pos);
-        
-       BOOST_ASSERT((pos != 0 && inset == inset2)
-                    || inset == inset3);
+       BOOST_ASSERT((pos != 0 && inset == insetBefore)
+               || inset == pars_[pit].getInset(pos));
+
        // Make sure the cursor points to the position before
        // this inset.
-       if (inset == pars_[pit].getInset(pos - 1))
+       if (inset == insetBefore)
                --cur.pos();
+
+       // Try to descend recursively inside the inset.
        inset = inset->editXY(cur, x, y);
+
        if (cur.top().text() == this)
                setCurrentFont(cur);
        return inset;