On Sun, Sep 16, 2007 at 10:41:21AM +0200, Abdelrazak Younes wrote:
> Martin Vermeer wrote:
> >On Sun, Sep 16, 2007 at 04:27:04AM +0200, Tommaso Cucinotta wrote:
> >>Hi,
> >>
> >>I couldn't really understand what information is
> >>stored inside the BufferView.offset_ref_ variable.
> >>At a first glance, it would seem that anchor_ref_
> >>stores the "paragraph offset" that is displayed from
> >>the WorkArea top line, and offset_ref_ stores the
> >>"pixel offset". Namely, the top WorkArea line of
> >>pixels would display the offset_ref_-th line of
> >>the anchor_ref_-th paragraph.
> >
> >Almost right. IIRC anchor_ref_ represents the top visible paragraph,
> >and offset_ref_ the offset, in pixels, of the cursor position (which may
> >be in a later paragraph).
> 
> Well, I guess this has changed in the 1.5 series (probably my doing) but 
> the offset_ref_ is independent from the cursor position and the 
> anchor_ref_ is not necessarily the top visible paragraph.
> 
> The anchor_ref_ is really the anchor paragraph of the BufferView from 
> which all other paragraphs are positioned.

...which is one of the visible paragraphs, not necessarily the top one

> The offset_ref_ is basically the offset position of the anchor paragraph 
> from the top screen (and that is 0). In effect, offset_ref_ is just the 
> opposite of the paragraph position on screen and I am really tempted to 
> rename that.
> 
> >
> >"Normalization" means making the cursor paragraph the top one on-screen.

See BufferView.cpp:288 "...making the cursor paragraph the anchor one."
(I think). This code doesn't actually say anything about the screen
position of the anchor.

> Well, in the current implementation, center() will center the cursor 
> position on screen, not necessarily the paragraph.

OK.
 
> > 
> >>Even if I keep these two values in sync with the scrollbar,
> >>it seems there are other variables that decide what pars
> >>the workarea starts displaying from the top.
> >
> >Yes.
> >
> >>Moreover, what var decides how the gray text background
> >>is cut at the end of the doc ?
> >
> >Yes, that is tricky. It's years ago that I looked at this :-(
> >I suspect it is in GuiWorkArea::setScrollbarParams():
> >
> >        // do what cursor movement does (some grey)
> >        h += height() / 4;
> 
> Look at the end of BufferView::draw() to understand how the grey area 
> size is calculated.

Are you sure? I don't see any calculation, just decision logic.
 
> Abdel.
> 

Reply via email to