]> git.lyx.org Git - features.git/commitdiff
Fix crash when scrolling up using the arrow keys.
authorAbdelrazak Younes <younes@lyx.org>
Mon, 1 Jan 2007 09:31:43 +0000 (09:31 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 1 Jan 2007 09:31:43 +0000 (09:31 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16450 a592a061-630c-0410-9148-cb99ea01b6c8

src/text2.C

index c41a9c4c1eaae7f4e9f5ccae58cf7757fa526d7c..26c85f3b1c9092a4b4b23fd427fb66a04a8d2dd6 100644 (file)
@@ -757,7 +757,12 @@ pos_type LyXText::getColumnNearX(BufferView const & bv, int right_margin,
 {
        Buffer const & buffer = *bv.buffer();
        TextMetrics const & tm = bv.textMetrics(this);
-       int const xo = bv.coordCache().get(this, pit).x_;
+
+       /// For the main LyXText, it is possible that this pit is not
+       /// yet in the CoordCache when moving cursor up.
+       /// x Paragraph coordinate is always 0 for main text anyway.
+       int const xo = isMainText(*bv.buffer())?
+               0 : bv.coordCache().get(this, pit).x_;
        x -= xo;
        RowMetrics const r = tm.computeRowMetrics(pit, row);
        Paragraph const & par = pars_[pit];