From 5514cc9901417e18f71c202153a6407f7204e17c Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Sun, 12 Nov 2006 11:24:27 +0000 Subject: [PATCH] * bufferview_funcs.C: reconstruct par.rows() in case of empty par creation. * 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 | 4 +++- src/text2.C | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bufferview_funcs.C b/src/bufferview_funcs.C index 99f5a8a46c..bd47dcefa7 100644 --- a/src/bufferview_funcs.C +++ b/src/bufferview_funcs.C @@ -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(sl.text())->redoParagraph(const_cast(bv), sl.pit()); BOOST_ASSERT(!par.rows().empty()); y -= par.rows()[0].ascent(); #if 1 diff --git a/src/text2.C b/src/text2.C index 28c7cf93de..0513d5181c 100644 --- a/src/text2.C +++ b/src/text2.C @@ -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 -- 2.39.2