From: Stefan Schimanski Date: Tue, 5 Feb 2008 14:23:59 +0000 (+0000) Subject: * show anchor paragraph completely if the whole buffer is visible. X-Git-Tag: 1.6.10~6444 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=bfd3a964b34977cba620b71ac2ccf651167e9648;p=features.git * show anchor paragraph completely if the whole buffer is visible. We need some better handling of the case when the cursor is in the very first line, but the line is not completely visible. If the line is not heigher than the BufferView we should scroll up to show it completely. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22790 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferView.cpp b/src/BufferView.cpp index fe8e4c34c6..3518d0b7e8 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -1777,6 +1777,19 @@ void BufferView::updateMetrics() // Rebreak anchor paragraph. tm.redoParagraph(d->anchor_pit_); ParagraphMetrics & anchor_pm = tm.par_metrics_[d->anchor_pit_]; + + // position anchor + if (d->anchor_pit_ == 0) { + int scrollRange = d->scrollbarParameters_.max - d->scrollbarParameters_.min; + + // Complete buffer visible? Then it's easy. + if (scrollRange == 0) + d->anchor_ypos_ = anchor_pm.ascent(); + + // FIXME: Some clever handling needed to show + // the _first_ paragraph up to the top if the cursor is + // in the first line. + } anchor_pm.setPosition(d->anchor_ypos_); LYXERR(Debug::PAINTING, "metrics: "