> So I gave it another try... see attached. This is essentially based upon > the 'row signature' approach mentioned by Jean-Marc in a later post.
The logic seems reasonable to me, but you're far more expert at that than I am. Some small niggles with the code: You'll get complaints here on 64bit machines std::size_t is bigger than unsigned int. Please use lyx::size_type. + // Row signature; has row changed since last paint? + unsigned row_sig = rit->endpos() - rit->pos() + y; No need to waste cycles... InsetList::const_iterator iend = par.insetlist.end(); for ( ; ii != iend; ++ii) { if (ii->pos >= rit->pos() && ii->pos < rit->endpos() && ii->inset->editable() == InsetBase::HIGHLY_EDITABLE) insetinrow = true; + break; } This assumes a 1-to-1 correspondence between rowno and the row_sig() container, a vector. Is that justifiable? Maybe it would be safer/cheaper to use std::map<lyx::size_type, lyx::size_type> row_sig_; ... par.row_sig()[rowno] = row_sig; ? Means you'll also be able to remove the tests on size()... // Add to row signature cache if (rowno >= par.row_sig().size()) par.row_sig().push_back(row_sig); else par.row_sig()[rowno] = row_sig; Be const correct. const bool select... + bool select = bv.cursor().selection(); Is this legal? Anyway, you don't need to zero-initialize a std::container. Paragraph::Paragraph() - : begin_of_body_(0), pimpl_(new Paragraph::Pimpl(this)) + : row_sig_(0), begin_of_body_(0), pimpl_(new Paragraph::Pimpl(this)) Yuck! Why are you making a variable public? Also, it appears to be neither initialised in the constructor above, nor does it appear to be used in your patch! public: /// InsetList insetlist; + /// + bool breakFlag; -- Angus