On Mon, 25 Jul 2005 18:09:12 +0100 John Levon 
<[EMAIL PROTECTED]> wrote: 
> On Mon, Jul 25, 2005 at 07:46:39PM +0300, Martin Vermeer wrote:
> 
> > 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 > 
> This is not a fix at all but an (unpleasant) workaround... but we 
can > live with it.

If you like... it is as good as we can do without knowing the true 
height of every paragraph... which we have chosen not to. Not 
elegant, but will have to do.

BTW I also fixed the scrollbar arrow problems I reported on earlier: 
appears to be a case of lacking anchor/offset normalization. Works 
great now. 
OK to check the following in? (I am quite confident that this is 
right, but would appreciate a little stress testing)


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 20:25:25 -0000
@@ -440,9 +440,22 @@ void BufferView::Pimpl::updateScrollbar(
 
        // It would be better to fix the scrollbar to understand
        // 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))); +
+       // estimated average paragraph height:
+       int const wh = workarea().workHeight() / 4; 
+       int h = t.getPar(anchor_ref_).height();
+       // Normalize anchor/offset (MV):
+       while (offset_ref_ > h) {
+               anchor_ref_++;
+               offset_ref_ -= h;
+               h = t.getPar(anchor_ref_).height();
+       }
+       }
+       // The "+ 2" makes inoculates doc bottom display against
+       // unrealistic wh values (docs with very large paragraphs) (MV)
+       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