On Wed, 20 Jul 2005 02:10:00 +0200 Lars Gullik Bjønnes 
<[EMAIL PROTECTED]> wrote: 
> Martin Vermeer <[EMAIL PROTECTED]> writes:
> 
> | This is a provisional patch, tested on a few test cases.
> >
> | I can't say I like the logic, but if it works...
> 
> I need other eyes than mine to look at this one.
> /and someone to test it)
> 
> 
> -- 
>       Lgb

This patch is bogus. It's amazing what a few nights in the 
countryside can do for one's understanding of things...

The real problem has to do with the natural history of scrollbars in
general, and doesn't show in the LyX code. 

When you pull the scrollbar to the top, the top screenful of the doc 
will show. When you pull it to the bottom, the bottom screenful will 
show. However, the position of the top of the screen within the doc 
will be top-of-document and bottom-of-document MINUS ONE SCREENFUL, 
however! 
Now this computation only succeeds if we tell the scrollbar the 
vertical size of the doc in pixels. This is the first parameter of 
the setScrollbarParams call. In our case, however, this is only an 
approximate value (no. of paragraphs x one-quarter of a screen 
height) that may be unrealistic.

Say, we have a document that is 100 screenfuls tall. We tell the 
scrollbar, however, that it is only 50 screenfuls tall. When pulling 
the scrollbar down, it will now position the top of the screen at 98% 
of the document, expecting the range 98%-100% to be within the 
window. In reality, however, we will see the range 98%-99%, while 
99%-100% remains invisible, unreachable with the scrollbar.

This is the nature of our bug. The fix is to increase the grey area 
seen when scrolling to the bottom, from 25% to 75%. Then this 
overflow problem will only occur if the *average* paragraph size of a 
document exceeds a whole screenful (i.e., 4x the assumed average 
paragraph height, wh), which doesn't really happen for 
non-pathological docs. 
The attached works on the Qt side; I don't know about the xforms 
side. Please test; I will again be outside the known universe in the 
coming week or so, so feel free to check it (or a variant of it) in 
if it does the job. 
- Martin

BTW has anyone noticed that, e.g., in the User Guide, the little 
arrows on both ends of the scrollbar work erratically? Often getting 
stuck (usually on single-line paragraphs), sometimes even moving in 
the wrong direction, or "skipping". Try the bottom of the Users 
Guide. 
I'll sleep on that one ;-)

And now the patch: using lynx to access webmail... I'll just include 
it here.


Index: BufferView_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v
retrieving revision 1.592
diff -u -p -r1.592 BufferView_pimpl.C
--- BufferView_pimpl.C  17 Jul 2005 14:29:32 -0000      1.592
+++ BufferView_pimpl.C  25 Jul 2005 16:27:32 -0000
@@ -442,7 +442,9 @@ void BufferView::Pimpl::updateScrollbar(
        // values in [0..1] and divide everything by wh
        int const wh = workarea().workHeight() / 4;
        int const h = t.getPar(anchor_ref_).height();
-       workarea().setScrollbarParams(t.paragraphs().size() * wh, 
anchor_ref_ * wh + int(offset_ref_ * wh / float(h)), int (wh * 
defaultRowHeight() / float(h))); +      / float(h)), int (wh * 
workarea().setScrollbarParams((t.paragraphs().size() + 2) * wh, 
+               anchor_ref_ * wh + int(offset_ref_ * wh / float(h)), 
+               int(wh * defaultRowHeight() / float(h)));
 //     workarea().setScrollbarParams(t.paragraphs().size(), anchor_ref_, 
1);
 }
 

Reply via email to