}
+pair<pit_type, ParagraphMetrics const *> TextMetrics::firstVisible() const
+{
+ // This only works in the main text, I think (bottom > 0)
+ LASSERT(text_->isMainText(), return first());
+ auto it = find_if(par_metrics_.begin(), par_metrics_.end(),
+ [] (ParMetricsCache::value_type const & p) {
+ return p.second.hasPosition() && p.second.bottom() > 0;
+ });
+ return make_pair(it->first, &it->second);
+}
+
pair<pit_type, ParagraphMetrics const *> TextMetrics::last() const
{
LBUFERR(!par_metrics_.empty());
int const bv_height)
{
LASSERT(text_->isMainText(), return);
- pit_type const npit = pit_type(text_->paragraphs().size());
+
+ // Forget existing positions
+ for (auto & pm_pair : par_metrics_)
+ pm_pair.second.resetPosition();
if (!contains(anchor_pit))
// Rebreak anchor paragraph.
int y2 = anchor_ypos + anchor_pm.descent();
// We are now just below the anchor paragraph.
pit_type pit2 = anchor_pit + 1;
+ pit_type const npit = pit_type(text_->paragraphs().size());
for (; pit2 < npit && y2 < bv_height; ++pit2) {
if (!contains(pit2))
redoParagraph(pit2);
}
for (; it != et; ++it) {
- LYXERR(Debug::PAINTING, "examining: pit: " << it->first
- << " y: " << it->second.position());
+ // LYXERR(Debug::PAINTING, "examining: pit: " << it->first
+ // << " y: " << it->second.position());
if (it->first >= pit && it->second.top() <= y) {
pit = it->first;
size_t const nrows = pm.rows().size();
int const wh = bv_->workHeight();
// Remember left and right margin for drawing math numbers
- Changer changeleft = changeVar(pi.leftx, x + leftMargin(pit));
- Changer changeright = changeVar(pi.rightx, x + width() - rightMargin(pit));
+ Changer changeleft, changeright;
+ if (text_->isRTL(pit)) {
+ changeleft = changeVar(pi.leftx, x + rightMargin(pit));
+ changeright = changeVar(pi.rightx, x + width() - leftMargin(pit));
+ } else {
+ changeleft = changeVar(pi.leftx, x + leftMargin(pit));
+ changeright = changeVar(pi.rightx, x + width() - rightMargin(pit));
+ }
// Use fast lane in nodraw stage.
if (pi.pain.isNull()) {
}
}
- if (text_->isRTL(pit))
- swap(pi.leftx, pi.rightx);
-
BookmarksSection::BookmarkPosList bpl =
theSession().bookmarks().bookmarksInPar(bv_->buffer().fileName(), pm.id());