]> git.lyx.org Git - features.git/commitdiff
Fix crash when selection begins or ends outside the visible screen.
authorAbdelrazak Younes <younes@lyx.org>
Sun, 2 Sep 2007 10:23:28 +0000 (10:23 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sun, 2 Sep 2007 10:23:28 +0000 (10:23 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19992 a592a061-630c-0410-9148-cb99ea01b6c8

src/TextMetrics.cpp

index 061b07fbb10fe1c5e98694b5e25ef390fd67c112..e1c9c845b1252215f2118b2ae131004e4eb81782 100644 (file)
@@ -1703,6 +1703,11 @@ void TextMetrics::drawSelection(PainterInfo & pi, int x, int) const
            || bv_funcs::status(bv_, end) == bv_funcs::CUR_ABOVE)
                return;
 
+       if (beg.pit() < par_metrics_.begin()->first)
+               beg.pit() = par_metrics_.begin()->first;
+       if (end.pit() > par_metrics_.rbegin()->first)
+               end.pit() = par_metrics_.rbegin()->first;
+
        ParagraphMetrics const & pm1 = par_metrics_[beg.pit()];
        ParagraphMetrics const & pm2 = par_metrics_[end.pit()];
        Row const & row1 = pm1.getRow(beg.pos(), beg.boundary());