}
+int BufferView::topMargin() const
+{
+ // original value was 20px, which is 0.2in at 100dpi
+ return zoomedPixels(20);
+}
+
+
+int BufferView::bottomMargin() const
+{
+ // original value was 20px, which is 0.2in at 100dpi
+ return zoomedPixels(20);
+}
+
+
int BufferView::inPixels(Length const & len) const
{
Font const font = buffer().params().getFont();
Text & buftext = buffer_.text();
pit_type const bottom_pit = d->cursor_.bottom().pit();
TextMetrics & tm = textMetrics(&buftext);
- int old_height = tm.parMetrics(bottom_pit).height();
+ Dimension const old_dim = tm.parMetrics(bottom_pit).dim();
// make sure inline completion pointer is ok
if (d->inlineCompletionPos_.fixIfBroken())
// (if this paragraph contains insets etc., rebreaking will
// recursively descend)
tm.redoParagraph(bottom_pit);
- ParagraphMetrics const & pm = tm.parMetrics(bottom_pit);
- if (pm.height() != old_height)
+ ParagraphMetrics & pm = tm.parMetrics(bottom_pit);
+ if (pm.height() != old_dim.height()) {
// Paragraph height has changed so we cannot proceed to
// the singlePar optimisation.
return false;
+ }
+ // Since position() points to the baseline of the first row, we
+ // may have to update it. See ticket #11601 for an example where
+ // the height does not change but the ascent does.
+ pm.setPosition(pm.position() - old_dim.ascent() + pm.ascent());
tm.updatePosCache(bottom_pit);
// Rebreak anchor paragraph.
tm.redoParagraph(d->anchor_pit_);
- ParagraphMetrics & anchor_pm = tm.par_metrics_[d->anchor_pit_];
+ ParagraphMetrics & anchor_pm = tm.parMetrics(d->anchor_pit_);
// position anchor
if (d->anchor_pit_ == 0) {
pit_type pit1 = d->anchor_pit_ - 1;
for (; pit1 >= 0 && y1 >= 0; --pit1) {
tm.redoParagraph(pit1);
- ParagraphMetrics & pm = tm.par_metrics_[pit1];
+ ParagraphMetrics & pm = tm.parMetrics(pit1);
y1 -= pm.descent();
// Save the paragraph position in the cache.
pm.setPosition(y1);
pit_type pit2 = d->anchor_pit_ + 1;
for (; pit2 < npit && y2 <= height_; ++pit2) {
tm.redoParagraph(pit2);
- ParagraphMetrics & pm = tm.par_metrics_[pit2];
+ ParagraphMetrics & pm = tm.parMetrics(pit2);
y2 += pm.ascent();
// Save the paragraph position in the cache.
pm.setPosition(y2);