Fix crash when selection begins or ends outside the visible screen.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19992 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-09-02 10:23:28 +00:00
parent 4048448236
commit 8695368e29

View 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());