Thanks Brian for your elaborate response.

Its true, in general jumps just one page, but if the body pane is a bit
bigger / smaller than X full lines (ie total length is, for instance, 12'5
lines), it jumps one line more than desirable, so you have to go back to
read it.

In the way I use Leo, I keep resizing the body pane, so I cant just set a
body pane heigth and always use it. Hence the need for that script, you can
exactly control the jump.

Also, Im using a speed reading technique that implies reading 4-6 lines per
eye jump.
So I adjust the body pane to be 4/6 words wide, then read jumping down with
my eyes.

With current pgup and pgdn, with the line missing problem, makes it
impossible to speed read. Going back to read the missing line defeats the
whole purpose.
With the script I suggested, it just jumps exactly the same amount all the
time, so it becomes useful.

Im guessing the difference might be in the line number, mine being integer
and yours a flotat, or vice versa.

As per c.frame.body.bodyCtrl.linesPerPage() this comes from my recent
experiences with Leo, for reaching the widgets I use "c.frame.XXXXX"  XXX
being the widget name.
Im not able to elaborate much more, its because of the way I studied Leo,
just surfing leopyref, grabbing snippets that do what I need, and using
them elsewhere.
"c.frame.body.bodyCtrl" turns out to be the body pane, with a linesPerPage
method among others.

Best regards,
Fidel.


On Wed, Aug 20, 2014 at 3:02 AM, Brian Theado <[email protected]>
wrote:

> On Tue, Aug 19, 2014 at 8:16 PM, Brian Theado <[email protected]>
> wrote:
> > A few years ago the page up/down functionality was a fixed number of
> > lines. I looked into the QT cpp code and translated it to python and
> > checked it in:
> >
> >
> https://github.com/leo-editor/leo-editor/commit/9401804f956c0eef31d2068450a21436e9939268
>
> Whoops, that was an earlier commit which took a different approach.
> Here is the commit which implements the port of the QT code to python:
>
>
> https://github.com/leo-editor/leo-editor/commit/3f0dc96e7fe155692a06b08eb40be917a7f52e97
>
> Here is a UNL to the code in question:
>
> leo-editor/leo/core/LeoPyRef.leo#Code-->Qt gui-->@file
> ../plugins/qtGui.py--> << define text widget classes >>--> << define
> LeoQTextEditWidget class >>-->leoMoveCursorHelper & helper
> (LeoQTextEditWidget)-->pageUpDown
>
> The code moves the cursor one line at a time until the total screen
> distance moved is greater than or equal to the height of the body.
> After that, it moves the scroll bar one page in the same direction the
> cursor was moved.
>
> So I'd be interested in hearing in what situation it breaks for you.
>
> > 2) Where did the c.frame.body.bodyCtrl.linesPerPage() function come
> > from? Did I just miss it when I made my change a few years ago?
>
> The pageUpDown implementation will work even if some lines have
> different height.  Not sure that ever happens, but linesPerPage will
> not handle that case.
>
> Brian
>
> --
> You received this message because you are subscribed to the Google Groups
> "leo-editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/leo-editor.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to