The branch, properpaint, has been updated. discards 17de8a989da8ec950814e044a6419c6c3fd65d43 (commit)
This update added new revisions after undoing existing revisions. That is to say, the old revision is not a strict subset of the new revision. This situation occurs when you --force push a change and generate a repository containing something like this: * -- * -- B -- O -- O -- O (17de8a989da8ec950814e044a6419c6c3fd65d43) \ N -- N -- N (c564d09ffab8529a4883dbd268866d59958622bd) When this happens we assume that you've already had alert emails for all of the O revisions, and so we here report only the revisions in the N branch from the common base, B. - Log ----------------------------------------------------------------- commit c564d09ffab8529a4883dbd268866d59958622bd Author: Jean-Marc Lasgouttes <lasgout...@lyx.org> Date: Wed Aug 30 18:05:16 2017 +0200 Update insets position in cache in more cases This patch makes sure that, every time a ParagraphMetrics has its position set, the inset positions for the insets held by this paragraph are remembered too. This is complementary to BufferView::updatePosCache, but I do not have hard evidence that this is required other than to increase robustness. It may help in some cases when scrolling the document (scrollbar, cursor up/down, page up/down). diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 1673de1..ab264ba 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -2658,6 +2658,7 @@ bool BufferView::singleParUpdate() // the singlePar optimisation. return false; + tm.updatePosCache(bottom_pit); d->update_strategy_ = SingleParUpdate; LYXERR(Debug::PAINTING, "\ny1: " << pm.position() - pm.ascent() @@ -2711,6 +2712,7 @@ void BufferView::updateMetrics() // in the first line. } anchor_pm.setPosition(d->anchor_ypos_); + tm.updatePosCache(d->anchor_pit_); LYXERR(Debug::PAINTING, "metrics: " << " anchor pit = " << d->anchor_pit_ @@ -2726,6 +2728,7 @@ void BufferView::updateMetrics() y1 -= pm.descent(); // Save the paragraph position in the cache. pm.setPosition(y1); + tm.updatePosCache(pit1); y1 -= pm.ascent(); } @@ -2739,6 +2742,7 @@ void BufferView::updateMetrics() y2 += pm.ascent(); // Save the paragraph position in the cache. pm.setPosition(y2); + tm.updatePosCache(pit2); y2 += pm.descent(); } diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index c6f6bbf..c88e5c6 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -43,6 +43,7 @@ #include "frontends/FontMetrics.h" #include "frontends/Painter.h" +#include "frontends/NullPainter.h" #include "support/debug.h" #include "support/lassert.h" @@ -198,6 +199,14 @@ bool TextMetrics::metrics(MetricsInfo & mi, Dimension & dim, int min_width) } +void TextMetrics::updatePosCache(pit_type pit) const +{ + frontend::NullPainter np; + PainterInfo pi(bv_, np); + drawParagraph(pi, pit, origin_.x_, par_metrics_[pit].position()); +} + + int TextMetrics::rightMargin(ParagraphMetrics const & pm) const { return text_->isMainText() ? pm.rightMargin(*bv_) : 0; @@ -1219,6 +1228,7 @@ void TextMetrics::newParMetricsDown() redoParagraph(pit); par_metrics_[pit].setPosition(last.second.position() + last.second.descent() + par_metrics_[pit].ascent()); + updatePosCache(pit); } @@ -1233,6 +1243,7 @@ void TextMetrics::newParMetricsUp() redoParagraph(pit); par_metrics_[pit].setPosition(first.second.position() - first.second.ascent() - par_metrics_[pit].descent()); + updatePosCache(pit); } // y is screen coordinate diff --git a/src/TextMetrics.h b/src/TextMetrics.h index 3000b21..ae99490 100644 --- a/src/TextMetrics.h +++ b/src/TextMetrics.h @@ -62,6 +62,11 @@ public: /// void newParMetricsUp(); + /// The "nodraw" drawing stage for one single paragraph: set the + /// positions of the insets contained this paragraph in metrics + /// cache. Related to BufferView::updatePosCache. + void updatePosCache(pit_type pit) const; + /// Gets the fully instantiated font at a given position in a paragraph /// Basically the same routine as Paragraph::getFont() in Paragraph.cpp. /// The difference is that this one is used for displaying, and thus we ----------------------------------------------------------------------- Summary of changes: src/BufferView.cpp | 1 + src/TextMetrics.cpp | 1 - 2 files changed, 1 insertions(+), 1 deletions(-) hooks/post-receive -- Repository for new features