]> git.lyx.org Git - lyx.git/commitdiff
* bufferview_funcs.C: reconstruct par.rows() in case of empty par creation.
authorAbdelrazak Younes <younes@lyx.org>
Sun, 12 Nov 2006 11:24:27 +0000 (11:24 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sun, 12 Nov 2006 11:24:27 +0000 (11:24 +0000)
* text2.C: tiny optimisation in LyXText::editXY()

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15878 a592a061-630c-0410-9148-cb99ea01b6c8

src/bufferview_funcs.C
src/text2.C

index 99f5a8a46c58beeac8d7e8bdcad01a9a168ca01f..bd47dcefa772b240c6c7cb34ab2f44c302a6a175 100644 (file)
@@ -177,7 +177,9 @@ Point coordOffset(BufferView const & bv, DocIterator const & dit,
        // Add contribution of initial rows of outermost paragraph
        CursorSlice const & sl = dit[0];
        Paragraph const & par = sl.text()->getPar(sl.pit());
-       // FIXME: I wonder if a case exists where this could happen:
+       if (par.rows().empty())
+               // FIXME: The special case below happens for empty paragraph creation
+               const_cast<LyXText *>(sl.text())->redoParagraph(const_cast<BufferView &>(bv), sl.pit());
        BOOST_ASSERT(!par.rows().empty());
        y -= par.rows()[0].ascent();
 #if 1
index 28c7cf93deb9b12647f653b1c16ff053f0549719..0513d5181c24454afdcd574ff0d8553f070b2c41 100644 (file)
@@ -986,7 +986,7 @@ InsetBase * LyXText::editXY(LCursor & cur, int x, int y)
                return 0;
        }
 
-       InsetBase * insetBefore = pars_[pit].getInset(pos - 1);
+       InsetBase * insetBefore = pos? pars_[pit].getInset(pos - 1): 0;
        //InsetBase * insetBehind = pars_[pit].getInset(pos);
 
        // This should be just before or just behind the