On Sun, Jan 01, 2006 at 03:25:31AM +0100, Lars Gullik Bjønnes wrote: > Martin Vermeer <[EMAIL PROTECTED]> writes:
... > | I'll commit the isChanged version if no-one objects. Verified that it > | does the job for both deletions and insertions. > > Ok, with me. Actually I'd prefer to commit the attached. It is more general in that it *always* repaints the row that the cursor is on, whether directly, or in some inset. So I modified the cursor position test routine, achieving a simplification too. Tested and appears to work as well as before. OK to commit? - Martin
Index: rowpainter.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.C,v retrieving revision 1.161 diff -u -p -r1.161 rowpainter.C --- rowpainter.C 30 Dec 2005 19:02:52 -0000 1.161 +++ rowpainter.C 1 Jan 2006 08:34:15 -0000 @@ -729,17 +729,14 @@ lyx::size_type calculateRowSignature(Row } -bool isCursorInInsetInRow(PainterInfo & pi, RowList::const_iterator rit, - Paragraph const & par) +bool isCursorOnRow(PainterInfo & pi, pit_type pit, RowList::const_iterator rit) { - InsetList::const_iterator ii = par.insetlist.begin(); - InsetList::const_iterator iend = par.insetlist.end(); - for ( ; ii != iend; ++ii) { - if (ii->pos >= rit->pos() && ii->pos < rit->endpos() - && ii->inset->isTextInset() - && pi.base.bv->cursor().isInside(ii->inset)) - return true; - } + LCursor & cur = pi.base.bv->cursor(); + for (lyx::size_type d = 0; d < cur.depth(); d++) + if (cur[d].pit() == pit + && cur[d].pos() >= rit->pos() + && cur[d].pos() < rit->endpos()) + return true; return false; } @@ -767,15 +764,13 @@ void paintPar // Row signature; has row changed since last paint? lyx::size_type const row_sig = calculateRowSignature(*rit, par); - // The following code figures out if the cursor is inside - // an inset _on this row_. - bool cur_in_inset_in_row = isCursorInInsetInRow(pi, rit, par); - + bool cursor_on_row = isCursorOnRow(pi, pit, rit); + // If selection is on, the current row signature differs from // from cache, or cursor is inside an inset _on this row_, // then paint the row - if (repaintAll || par.rowSignature()[rowno] != row_sig - || cur_in_inset_in_row) { + if (repaintAll || par.rowSignature()[rowno] != row_sig + || cursor_on_row) { // Add to row signature cache par.rowSignature()[rowno] = row_sig;
pgpko4mc1fPYj.pgp
Description: PGP signature