Add an option to specify the number of overlapping lines when scrolling
page by page (0 by default because this is ELinks' current behaviour).
I think that repeating the last line of the screen when scrolling makes reading 
long pages easier; this also is what slrn does, so with this patch I can make 
them behave in the same way when scrolling page by page.

Signed-off-by: Fabienne Ducroquet <fabi...@gmail.com>
---
 src/config/options.inc |    5 +++++
 src/viewer/text/view.c |    4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/config/options.inc b/src/config/options.inc
index 9969e25..7f5fb6d 100644
--- a/src/config/options.inc
+++ b/src/config/options.inc
@@ -397,6 +397,11 @@ static struct option_info config_options_info[] = {
                N_("Number of lines to scroll when a key bound to scroll-up "
                "or scroll-down is pressed and no prefix was given.")),
 
+       INIT_OPT_INT("document.browse.scrolling", N_("Vertical overlap"),
+               "vertical_overlap", 0, 0, 10, 0,
+               N_("Number of overlapping lines between the new page displayed "
+               "and the previous one when scrolling one page up or down.")),
+
 
        INIT_OPT_TREE("document.browse", N_("Searching"),
                "search", 0,
diff --git a/src/viewer/text/view.c b/src/viewer/text/view.c
index 3a031b3..686daee 100644
--- a/src/viewer/text/view.c
+++ b/src/viewer/text/view.c
@@ -94,7 +94,7 @@ move_down(struct session *ses, struct document_view 
*doc_view, int type)
 
        assert(ses->navigate_mode == NAVIGATE_LINKWISE);        /* XXX: drop it 
at some time. --Zas */
 
-       newpos = doc_view->vs->y + doc_view->box.height;
+       newpos = doc_view->vs->y + doc_view->box.height - 
get_opt_int("document.browse.scrolling.vertical_overlap", ses);
        if (newpos < doc_view->document->height)
                doc_view->vs->y = newpos;
 
@@ -134,7 +134,7 @@ move_up(struct session *ses, struct document_view 
*doc_view, int type)
 
        if (doc_view->vs->y == 0) return;
 
-       doc_view->vs->y -= doc_view->box.height;
+       doc_view->vs->y -= (doc_view->box.height - 
get_opt_int("document.browse.scrolling.vertical_overlap", ses));
        int_lower_bound(&doc_view->vs->y, 0);
 
        if (current_link_is_visible(doc_view))
-- 
1.6.5.7

_______________________________________________
elinks-dev mailing list
elinks-dev@linuxfromscratch.org
http://linuxfromscratch.org/mailman/listinfo/elinks-dev

Reply via email to