[LyX/master] Add ScrollType BOTTOM and TOGGLE for BufferView::scrollToCursor()

Jean-Marc Lasgouttes lasgouttes at lyx.org
Fri Sep 6 13:33:24 UTC 2024


Le 06/09/2024 à 14:56, Jean-Marc Lasgouttes a écrit :
> commit 6c20e5db7db662239e8c2bd47fe28d18b27bd729
> Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
> Date:   Thu Sep 5 22:05:38 2024 +0200
> 
>      Add ScrollType BOTTOM and TOGGLE for BufferView::scrollToCursor()
>      
>      BOTTOM shows the paragraph containing the cursor at the bottom of the
>      work area.
>      
>      TOGGLE does CENTER, then TOP, BOTTOM and finally cycles to CENTER.
>      This is a feature copied from emacs's C-l binding.
>      
>      Add new argument "caret" to lfun "scroll" that can be used like
>        scroll caret center
>      
>      Change the keys (either C-l, M-l or F5) bound to screen-recenter to
>      "scroll caret toggle".
>      
>      As an experiment, change paragraph-goto to use this scrolling method.
>      This can be tested when going to a heading in the outline pane.

Dear all,

These two last changes are the whole point of this commit, and part of 
the motivation of my recent work on scrolling. This is stolen from 
emacs: the binding F5 (cua), M-l (mac) or C-l (emacs) now puts caret at 
center as expected, but, when repeated, it now goes to top and then bottom.

This a very good tool IMO to see the context around an element. I use it 
for code.

Then, I changed the outline to yield the same effect. I expect some of 
you to hate it, but discussion is good and this is not the final design. 
Again, clicking several times on an element shows what is below it, 
around it, and so forth.

I also noticed several weird things:

* when aligning to top, only the top level paragraph is taken into 
account. If I have a large branch with headings in it, the code will try 
to show the branch in full and otherwise the heading will be at the 
bottom. What's the point of doing that?

* the same happens with an equation in a possibly large paragraph. The 
priority is to put the paragraph first.

* there is some ad-hoc code that adds twice the height of a typical row 
before the paragraph. In passing, this means that a tall row (Chapter) 
will be barely shown completely. I remember that changing that has met 
resistance and I had to revert it. How is this useful to you?

JMarc




More information about the lyx-devel mailing list