Abdelrazak Younes wrote:
Stefan Schimanski wrote:
Hi!

It seems that a big annoyance for many people is the bad scrolling in 1.5 and 1.6. The paragraph heights are estimated by some tricky logic which more or less takes the average of the visible paragraphs. The bug report: http://bugzilla.lyx.org/show_bug.cgi?id=2426

Is anybody working on this?

I've played with it a bit together with Tommaso (off-list).

I was playing around with the straight forward approach to cache the paragraph heights in some map which maps Paragraph* to height. Then instead of using the estimate to guess a size for invisible paragraphs I just used a loop to add up the cached values (this could be improved of course by some clever use of a balanced binary tree to get sums up to every paragraph for free).

Of course the whole approach only works if the cache is filled (enough) with real heights. This is not the case at the beginning. But as soon as it is filled you get perfect scrolling behaviour.

I think most other applications do some layouting in the background to get those height values. Has anybody tried to do the same with LyX?

One could fill up the height cache in idle times for example after the document is loaded, maybe with some regulation to not stress the machine too much.

This is exactly our plan ;-)

I don't think this is solvable easily in 1.5 but this is easily solvable for 1.6.

You don't really need a map. A vector of height for the outermost paragraphs should be enough. Initially the vector would be filled with nominal values. Each time a paragraph metrics is calculated, the nominal value will be replaced by the real height. We have to be careful to maintain the vector in line with the main paragraph list. If the user experience is not good enough, we can add one or two paragraph metrics calculations at each cursor blink.
This calculation at each blink will only be for
the initial calculations when a document is loaded or
the main window resized? So as to fill the cache,
without having the user wait?

Once the cache is full, all paragraph heights should
be updated as they are changed, so there
won't a possibly expensive calculation at each blink.

Helge Hafting



Reply via email to