simplify selected text painting.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24769 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-05-14 15:16:10 +00:00
parent 2cf301033e
commit ffc1002291

View File

@ -243,10 +243,7 @@ void RowPainter::paintChars(pos_type & vpos, FontInfo const & font,
} }
// selected text? // selected text?
pit_type const p0 = pi_.base.bv->cursor().selBegin().pit(); bool const selection = pos >= row_.sel_beg && pos < row_.sel_end;
bool selection = row_.sel_beg > -1 && row_.sel_beg != row_.sel_end
&& ((pit_ == p0 && (pos >= row_.sel_beg && pos < row_.sel_end))
|| (pit_ > p0 && pos < row_.sel_end));
// collect as much similar chars as we can // collect as much similar chars as we can
for (++vpos ; vpos < end ; ++vpos) { for (++vpos ; vpos < end ; ++vpos) {
@ -254,8 +251,8 @@ void RowPainter::paintChars(pos_type & vpos, FontInfo const & font,
if (pos < font_span.first || pos > font_span.last) if (pos < font_span.first || pos > font_span.last)
break; break;
if (row_.sel_beg > -1 && row_.sel_beg != row_.sel_end && bool const new_selection = pos >= row_.sel_beg && pos < row_.sel_end;
((pit_ == p0 && pos == row_.sel_beg) || pos == row_.sel_end)) if (selection != new_selection)
break; break;
if (prev_change != par_.lookupChange(pos).type) if (prev_change != par_.lookupChange(pos).type)