From: Abdelrazak Younes Date: Thu, 9 Nov 2006 10:13:13 +0000 (+0000) Subject: a small cleanup, a tiny optimization and a comment. X-Git-Tag: 1.6.10~11969 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=1ce9a35c4d0d353702ea2650390eacdc1238ce86;p=features.git a small cleanup, a tiny optimization and a comment. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15817 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/text2.C b/src/text2.C index 16ca5c565b..7dcc542d63 100644 --- a/src/text2.C +++ b/src/text2.C @@ -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;