]> git.lyx.org Git - features.git/commitdiff
scrolling tweaks... asymptotically tending towards scrolling correctness...
authorAbdelrazak Younes <younes@lyx.org>
Wed, 16 Jan 2008 14:31:00 +0000 (14:31 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 16 Jan 2008 14:31:00 +0000 (14:31 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22599 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.cpp

index f245fbabf0ed15ccfb7b04f8cf0f58ef4772b1f8..a7b5e77af54de096ac1531abe46a61d6beb0521c 100644 (file)
@@ -449,14 +449,13 @@ void BufferView::updateScrollbar()
        // Build temporary cursor.
        Cursor cur(*this);
        cur.push(buffer_.inset());
-       /*Inset * inset =*/ tm.editXY(cur, width_ / 4, 10);
+       /*Inset * inset =*/ tm.editXY(cur, 0, 10);
        pit_type const first_visible_pit = cur.bottom().pit();
        d->scrollbarParameters_.position = coordOffset(cur, cur.boundary()).y_;
-       // FIXME: The screen position (width_/4, 10) works reasonably well
-       // for most texts but in some cases the first visible cursor position is
-       // hard to find when the screen begins with a Label for example. So in the
-       // case where coordOffset() returns (0,0), we should try with another
-       // position and/or look at the returned Inset geometry.
+       d->scrollbarParameters_.position -=
+               tm.parMetrics(first_visible_pit).position();
+       // FIXME: The screen position (0, 10) works reasonably well for most texts
+       // but the top and bottom positions are still not quite correct.
        LYXERR(Debug::SCROLLING, "first visible pit : " << first_visible_pit);
        LYXERR(Debug::SCROLLING, "offset from top : "
                << d->scrollbarParameters_.position);