diff --git a/src/BufferView.C b/src/BufferView.C index ad86b9f944..26008cacd4 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -1365,6 +1365,10 @@ void BufferView::updateMetrics(bool singlepar) << endl; metrics_info_ = ViewMetricsInfo(pit1, pit2, y1, y2, singlepar, size); + + if (lyxerr.debugging(Debug::WORKAREA)) { + coord_cache_.dump(); + } } diff --git a/src/coordcache.C b/src/coordcache.C index f3647189fb..a7f8a511e2 100644 --- a/src/coordcache.C +++ b/src/coordcache.C @@ -49,4 +49,24 @@ Point CoordCache::get(LyXText const * text, lyx::pit_type pit) return posit->second; } +void +CoordCache::dump() const { + lyxerr << "ParPosCache contains:" << std::endl; + for (ParPosCache::const_iterator i = getParPos().begin(); i != getParPos().end(); ++i) { + LyXText const * lt = (*i).first; + InnerParPosCache const & cache = (*i).second; + lyxerr << "LyXText:" << lt << std::endl; + for (InnerParPosCache::const_iterator j = cache.begin(); j != cache.end(); ++j) { + pit_type pit = (*j).first; + Paragraph const & par = lt->getPar(pit); + Point p = (*j).second; + lyxerr << "Paragraph " << pit << ": \""; + for (int k = 0; k < std::min(10, par.size()); ++k) { + lyxerr << lyx::to_utf8(docstring(1,par.getChar(k))); + } + lyxerr << "\" has point " << p.x_ << "," << p.y_ << std::endl; + } + } +} + } // namespace lyx diff --git a/src/coordcache.h b/src/coordcache.h index 4423b3459d..1b87794afd 100644 --- a/src/coordcache.h +++ b/src/coordcache.h @@ -105,7 +105,7 @@ private: * A global cache that allows us to come from a paragraph in a document * to a position point on the screen. * All points cached in this cache are only valid between subsequent - * updated. (x,y) == (0,0) is the upper left screen corner, x increases + * updates. (x,y) == (0,0) is the upper left screen corner, x increases * to the right, y increases downwords. * The cache is built in BufferView::updateMetrics which is called * from BufferView::Pimpl::update. The individual points are added @@ -142,6 +142,8 @@ public: return boundary ? slices1_ : slices0_; } + /// Dump the contents of the cache to lyxerr in debugging form + void dump() const; private: /// MathArrays CoordCacheBase arrays_;